Version v10.0p_2015-10-05/LGPL Development Only (2015-10-05)
If a datasource is attached to a listgrid and useAllDataSourceFields is true and you select columns from the advancedfieldpicker, the requested order is not applied.
check this behaviour in the example below:
Add field one after field two, in the resulting list field1 will before field2. This is inconsistent.
This does work, if useAllDataSourceFields is false.
Example @http://www.smartclient.com/docs/10.0/a/system/reference/SmartClient_Explorer.html#fieldPicker:
If a datasource is attached to a listgrid and useAllDataSourceFields is true and you select columns from the advancedfieldpicker, the requested order is not applied.
check this behaviour in the example below:
Add field one after field two, in the resulting list field1 will before field2. This is inconsistent.
This does work, if useAllDataSourceFields is false.
Example @http://www.smartclient.com/docs/10.0/a/system/reference/SmartClient_Explorer.html#fieldPicker:
Code:
function createDS(fieldCount) { var fields = []; for(var i = 1; i <= fieldCount; i++) { fields.add({name: "field" + i, title: "Field " + i, showIf: "false"}); } return isc.DataSource.create({ ID:'test', fields:fields, cacheData:createRecords(100,fields), clientOnly:true }) } function createRecords (recordCount, fields) { var records = []; for (var i = 0; i < recordCount; i++) { var record = {}; for (var j = 0; j < fields.length; j++) { record[fields[j].name] = "Row " + i + ", Value " + (j+1); } records.add(record); } return records; } function getOrderedFields(fields) { var initialFieldIndices = [ 2 ], i, orderedFields = []; for (i = 0; i < initialFieldIndices.length; i++) { var field = fields["field" + initialFieldIndices[i]]; orderedFields.add(field); delete field.showIf; } var keys = isc.getKeys(fields) for (i = 0; i < keys.length; i++) { var field = fields[keys[i]]; if (field.showIf != null) orderedFields.add(field); } return orderedFields; } var ds = createDS(4); isc.ListGrid.create({ ID: "pickableFields", useAllDataSourceFields:true, autoDraw:true, width:500, height:400, dataSource:ds, autoFetchData:true, autoFitData: "both", autoFitMaxRecords: 20, autoFitMaxColumns: 8, autoFitFieldWidths: true, canEditTitles: true, fields:getOrderedFields(ds.fields), useAdvancedFieldPicker: true, fieldPickerFieldProperties: [ "frozen" ], getBaseStyle: function (record, rowNum, colNum) { return colNum % 2 == 0 ? "myEvenGridCell" : "myOddGridCell"; } }); pickableFields.delayCall("editFields");
Comment