Hi, Isomorphic,
we found strange behavior of ListGrid when tried programmatically filter a list with fetchData(), on filter, SelectItem haven't shown a filtered option, so after some debugging we've found that bug is in SelectItem.js:
SelectItem.optionDataSource is null when used 'foreignKey', but this.getOptionDataSource() correctly returns.
proof of concept:
we found strange behavior of ListGrid when tried programmatically filter a list with fetchData(), on filter, SelectItem haven't shown a filtered option, so after some debugging we've found that bug is in SelectItem.js:
Code:
_valueIsValid : function (value) { if (this.addUnknownValues || this.optionDataSource) return true; // <- this.optionDataSource is undefined when 'foreignKey' is used. must be this.getOptionDataSource() here.
proof of concept:
Code:
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <meta http-equiv="Cache-control" content="no-cache"> <title></title> <script>var isomorphicDir = "smartclient/";</script> <script src=smartclient/system/modules-debug/ISC_Core.js></script> <script src=smartclient/system/modules-debug/ISC_Foundation.js></script> <script src=smartclient/system/modules-debug/ISC_Containers.js></script> <script src=smartclient/system/modules-debug/ISC_Grids.js></script> <script src=smartclient/system/modules-debug/ISC_Forms.js></script> <script src=smartclient/system/modules-debug/ISC_DataBinding.js></script> <script src=smartclient/skins/EnterpriseBlue/load_skin.js></script> </head> <body> <script> var optionsDataSource = isc.RestDataSource.create({ ID: "optionsDataSource", clientOnly: true, fields: [ {hidden: true, primaryKey: true, name: 'id', type: 'sequence', required: false}, {name: 'name', type: 'text'} ], testData: [ {id: 1, name: 'insert'}, {id: 2, name: 'update'}, {id: 3, name: 'remove'} ] }); var ds = isc.DataSource.create({ clientOnly: true, fields: [ {name: 'test', type: 'text', editorType: 'SelectItem', foreignKey: 'optionsDataSource.id'} ], testData: [] }); var listGrid = isc.ListGrid.create({ width: 700, showFilterEditor: true, dataSource: ds, fields: [ { name: 'test', filterEditorProperties: { autoFetchData: false, addUnknownValues: false } } ] }); ////FAST FIX: //var selectItem = listGrid.filterEditor.getEditFormItem('test'); //selectItem.optionDataSource = selectItem.getOptionDataSource(); listGrid.fetchData({test: 2}) // FilterEditor doesn't show a selected value. should be: 'update' </script> </body> </html>
Comment