Hello,
I'm having an issue with the check box function of the igGrid.
When deselecting the check box the row is staying selected.
i have tried the deselect method, but this also fails.
i get the following error in both scenarios "Uncaught TypeError: Cannot read property '0' of null "
I'm using the 2014 vesrion of the grid.
jquery 1.9 and jquery ui 1.11.1.
this is my code
<script> jQuery(function($) { $('#grid1').igGrid({ dataSource: '@Url.Action("dataset-binding")', autoGenerateColumns: false, columns: [ { hidden: true, key: "FirmIdString", template: "${FirmIdString}" }, { hidden: false, key: "CanSelectForExtraction", template: "${CanSelectForExtraction}" }, { headerText: "Firm Name", key: "FirmName", template: "${FirmName}", width: "65%" }, { headerText: "Status", key: "StatusDescription", template: "${StatusDescription}", width: "15%" }, { headerText: "Request Id", key: "StagingDatabaseId", template: "${StagingDatabaseId}", width: "15%" }, { headerText: "Request", key: "RequestId", template: "${RequestId}", hidden: true } ],
autoGenerateLayouts: false, mergeUnboundColumns: false, responseDataKey: 'Records', generateCompactJSONResponse: false, enableUTCDates: true, features: [ { sortUrlKey: 'sort', sortUrlKeyAscValue: 'asc', sortUrlKeyDescValue: 'desc', name: 'Sorting', type: 'remote' }, { recordCountKey: 'TotalRecordsCount', pageIndexUrlKey: 'page', pageSizeUrlKey: 'pageSize', name: 'Paging', pageSize: 25, type: 'remote' }, { filterExprUrlKey: 'filter', filterLogicUrlKey: 'filterLogic', name: 'Filtering', type: 'remote' }, { name: 'GroupBy', resultResponseKey: 'GroupBy', groupByUrlKey: 'sort', groupByUrlKeyAscValue: 'asc', groupByUrlKeyDescValue: 'desc', persist: false }, { name: 'Selection', mode: "row", multipleSelection: true, activation: false, rowSelectionChanging: function (evt, ui) { return false; } }, { name: 'RowSelectors', enableCheckBoxes: true, rowSelectorColumnWidth: '5%', enableRowNumbering: false, checkBoxStateChanging: function (evt, ui) { var record = $("#grid1").igGrid("findRecordByKey", ui.rowKey); if (ui.newState == 'off') { var selectedRows = $("#grid1").igGridSelection("selectedRows"); $("#grid1").igGridSelection("deselectRow", 0); // $("#grid1").igGridSelection("clearSelection"); }
if (record == null || (ui.newState == "on" && record.CanSelectForExtraction != true)) { return false; } return true;
} } ], width: '100%', primaryKey: 'FirmIdString', localSchemaTransform: false, cellClick: function(evt, ui) { if (ui.colKey == "StagingDatabaseId") { var dataBase = $("#grid1").igGrid("getCellText", ui.rowKey, "StagingDatabaseId"); if (!String.isNullOrEmpty(dataBase)) { var record = $("#grid1").igGrid("findRecordByKey", ui.rowKey); $(location).attr('href', '@Url.Action("Index", "RequestDetails")' + '/Index/' + record.RequestId.toString()); } } } }); });
Thanks, Stephen
Thank you for you quick response.
I have resolved the issue now, it seems there was a second copy of JQuery being rendered at the end of the page.
Thanks, Stephen.
Hello Stephen,
The rows should automatically be deselected in this scenario and calling the deselection function should not be necessary. I have tested this scenario using the online samples and the stated jquery and jquery UI versions but am so far unable to reproduce the behavior:
http://jsfiddle.net/4wjsxp32/3/
A working sample demonstrating the behavior would be greatly appreciated and would allow me to examine this matter further.
Please feel free to contact me with any updates.