I'm getting desperate, because the showIf() functionality of ListGridFields isn't working as I expected.
I have a grid based on a data source:
Reading the reference, it says showIf is a void() method. I would have expected an boolean method, but okay.
I have a checkbox in my screen, toggling the value of list._showAllFields. In its "changed" callback, if does this and calls grid.refreshFields(). After the first toggle, this value becomes true. After that I don't see any logging of my showIf-method. Leaving the "return" out, helps and the logging continues to show, but the field's visibility is not toggled.
What am I doing wrong? Or... how would somebody else dynamically show and hide fields in a grid. I have it working with showField and hideField, but this means a lot of method calls (for quite some fields) and separate calls for showing and hiding. I was hoping to save code by using showIf on the grid fields and calling refreshFields() on the grid.
I have a grid based on a data source:
Code:
this.dataSource = isc.RestDataSource.create({ fields: [ {name: 'period', canEdit: false, type: 'integer', width: 60}, ... }, ... }); this.grid = isc.ListGrid.create({ _showAllFields: false, dataSource: this.dataSource, fields: [ {name: 'period', showIf: 'console.log(list); return list._showAllFields;'} ], useAllDataSourceFields: true, ... });
I have a checkbox in my screen, toggling the value of list._showAllFields. In its "changed" callback, if does this and calls grid.refreshFields(). After the first toggle, this value becomes true. After that I don't see any logging of my showIf-method. Leaving the "return" out, helps and the logging continues to show, but the field's visibility is not toggled.
What am I doing wrong? Or... how would somebody else dynamically show and hide fields in a grid. I have it working with showField and hideField, but this means a lot of method calls (for quite some fields) and separate calls for showing and hiding. I was hoping to save code by using showIf on the grid fields and calling refreshFields() on the grid.
Comment