|
Title: Add a new Event Post by: leela on February 09, 2015, 03:15:58 PM Hi,
I want to add a new event to the datagrid like following, when singleSelect is true onBeforeUnselectAll: function(unselectIndex){}, where I need to get the index of the record that just got unselected. The OnUnSelect/onUncheck/onBeforeUnselect/onBeforeUncheck do not get fired in this case I have added this code to the selectRow() in the jquery.easyui.all.js file if (opts.singleSelect){ var unselectIndex = opts.finder.getTr(target, '', 'selected').attr("datagrid-row-index"); if(unselectIndex!=undefined && unselectIndex!=index){ opts.onBeforeUnselectAll.call(target, unselectIndex); } unselectAll(target); selectedRows.splice(0, selectedRows.length); } But want to know if there is a better way of doing it without modifying the library itself. Like just extend the datagrid API and add new events. Appreciate any help Title: Re: Add a new Event Post by: stworthy on February 09, 2015, 07:01:30 PM If you only want to get the row to be selected, please try the 'onBeforeSelect' instead.
Code: $('#dg').datagrid({Title: Re: Add a new Event Post by: leela on February 10, 2015, 04:20:27 PM Hi,
I am not trying to get the row to be selected. I am trying to get the row that will be unselected, when you select a row. Basically I have a Datagrid, with singleSelect option. Let us assume there are 3 rows. I selected row 2 (index - 1). Now when I select row 3(index - 2), row 2 gets unselected because of singleSelect:true option. I need to get the index of the row 2 that gets unselected, when I select row3. I expected onUnSelect to work, but looks like the onUnSelectAll is being triggered instead, because of singleSelect option So I need to get the index of all the records(basically only one record) that will be selected, before actually selecting the record clicked by User. Hope I conveyed my requirement clearly. Please let me know if you have any suggestions Title: Re: Add a new Event Post by: stworthy on February 10, 2015, 07:12:27 PM Please look at this example http://jsfiddle.net/zLobksxz/. You can get the unselected row before selecting a new row.
|