Hi,
I am working on NG Client and creating UI which is utilizing Servoy NG-Grids → DataGrid.
Foundset which is bound to DataGrid contains following fields of interest:
- Boolean(Check Box) (for selection)
- Text field (for description/detail of product)
- Date (for date of last stock updated)
I have successfully mapped text field and Date in DataGrid but cannot find a way to add Check Box as column in DataGrid. (In column ‘editType’ property, we can only select TextField, DatePicker, ComboBox or TypeAhead. No option for Check Box).
Any assistance in resolving above will be highly appreciated.
Thanks
Hi,
in the current version of the Data Grid there is not a check box editType indeed.
Is possible to implement the check-box behavior using the styleClassDataprovider for your “check-box column”. The styleClassDataprovider will be a calculation returning a font-icon (e.g. Font Awesome icon).
For example let’s assume your foundset has a column ‘active’ and you want to show in the grid all records where the value active = 1
function isActiveStyleClass() { // calculation to be used as styleClassDataprovider
return (active=== 1) ? 'fas fa-check-square' : 'fas fa-square';
}
You can then change the check foundset’s active value using the onCellClick event of the grid, toggling the active value from 0 to 1.
paronne:
Hi,
in the current version of the Data Grid there is not a check box editType indeed.
Is possible to implement the check-box behavior using the styleClassDataprovider for your “check-box column”. The styleClassDataprovider will be a calculation returning a font-icon (e.g. Font Awesome icon).
For example let’s assume your foundset has a column ‘active’ and you want to show in the grid all records where the value active = 1
function isActiveStyleClass() { // calculation to be used as styleClassDataprovider
return (active=== 1) ? 'fas fa-check-square' : 'fas fa-square';
}
You can then change the check foundset's active value using the onCellClick event of the grid, toggling the active value from 0 to 1.
Thanks paronne for your help. I will try this and will update you. Hopefully it will work for me. ![Smile :)]()
Can anyone advise if there is a plan to add checkbox editType on datagrid? The styleClassDataprovider workaround works, but it would be much more efficient to have it as a default feature.
You would need to add that to the issue list on the component: https://github.com/Servoy/aggridcomponents/issues
I don’t currently see anything listed for a checkbox component on the agGrid
Any updates on having a CHECKBOX editType in AG Grids?
I raised an issue https://github.com/Servoy/aggridcomponents/issues/38
I think there is just an image or css class workaround for now. So it just appears checked or unchecked.
yes, we’re using an onCellClick event to change the state of the boolean and a function that returns a font icon depending on its state.
return (active=== 1) ? 'fas fa-check-square' : 'fas fa-square';
Seems like a perfect use case for a new editType to handle all that.
Hi Antonio,
GoldCouger has the right approach. We just did a webinar with some UI tips & tricks for putting dynamic icons like that in the grid. You can watch it for examples.
https://servoy.com/webinars/tech-series/
Apart from that, checkbox support is on the list: https://support.servoy.com/browse/SVY-14487