jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Checkbox in grid
Tagged: checkbox, grid, JavaScript
This topic contains 6 replies, has 4 voices, and was last updated by sirisha 8 years, 5 months ago.
-
AuthorCheckbox in grid Posts
-
hi,
well the firts column of my grid it ‘s a checkbox ’cause i want the end user check this to delete the row but i set editmode : selectedcell , so when i select a cell the row selects, so i decide do this …find the first column “checkboxcolumn” and find the checkbox value , but this return undefined, i read checkbox documentation checkbox has 3 states so i set hasthreestate: false but i doesn’t work.
$('#jqxgrid').bind('rowselect', function (event) { var args = event.args; var row = args.rowindex; var value = $('#jqxgrid').jqxGrid('getcellvalue', row, getFistCheckboxColumn()); if (value == 'false') { $('#jqxgrid').jqxGrid('unselectrow', row); } });function getFistCheckboxColumn() { return $("#jqxgrid").jqxGrid('columns').records[0].datafield;} $("#jqxgrid").jqxGrid( { width: 878, source: dataAdapter, editable: true, altrows: true, enablehover: true, enabletooltips: true, enableanimations: true, keyboardnavigation: true, autoheight: true, pageable: true, columnsresize: true, pageable: true, columnsresize: true, theme: 'summer', editmode: 'selectedcell', selectionmode: 'multiplerows', theme: theme, columns: [ { <strong>text: 'fila', columntype: 'checkbox', width: 50, datafield: 'c', checked: false, hasThreeStates: false, disabled: true },</strong> { text: 'id', columntype: 'textbox', datafield: 'id', width: 50 }, { text: 'Numero de Cuenta', columntype: 'textbox', datafield: 'Account', width: 150 } ] });
Hi Jose,
The column definition does not support the ‘hasThreeStates’ property. The supported properties of the Grid columns are listed in the Grid’s API Reference help documentation here: jquery-grid-api.htm.
The ‘getcellvalue’ method returns the cell value based on the Row’s Bound Index and a valid DataField in the Data Source. If there’s no such record, i.e if there’s no datafield: ‘c’ in your data source, the returned value will be undefined.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.commmm yap , well this column doesn’t below to my datasource….. so i can’t get the value of my checkbox in this row?
As the CheckBox is a Grid editor, you can get its value when the user edits it.
$("#jqxgrid").bind('cellendedit', function (event) { var args = event.args; var value = args.value; });
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHow can display column of checkbox without dataField?
Hi Deep Shah,
Each column in jqxGrid must have a datafield event if it’s not present in your data source. I suggest you to take a look at this demo: customrowsselection.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
Is it possible to add three state checkbox to Jqxgrid ‘checkbox’ column?
-
AuthorPosts
You must be logged in to reply to this topic.