jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jqxgrid select only one row at a time even while having checkbox
Tagged: #jqwidgets-grid, grid, javascript grid, jquery grid
This topic contains 9 replies, has 3 voices, and was last updated by lioz assa 7 years, 4 months ago.
-
Author
-
Hi I have a jqxgrid with checkbox selection, there is a button column of right where I want it to select the row one at a time. So while clicking on the button it would not select multiple rows. But when using the checkbox, it should let you select multiple rows.
Here is my jsfiddle:
http://jsfiddle.net/RsV5g/430/Hello dan123,
You could use
clearselection
method of the Grid before select desired row.
Please, take a look the example below:buttonclick: function (row) { $('#jqxgrid').jqxGrid('clearselection'); $('#jqxgrid').jqxGrid('selectrow', row); }
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo,
One small problem though I had a rowselect event for the checkbox, and the var records = new Array(); is outside of the rowselect event in order for the checkbox to select multiple records and send to another grid.
So now whenever I click on the “Edit” button, it selects one per row which is great but the second grid is showing my previously selections too.
Note: I want to keep the rowselect event the way it is now because I want the checkbox to be able to select multiple records and show every rows details in the second grid.
Test Case
Try clicking on the button, the second grid keeps the previous selections too. Also when I click the button simultaneously it should not keep creating the new record over and over again in the second grid.Solution needed:
The second grid should only show the row details of the current selected row only.Here is my jsfiddle:
http://jsfiddle.net/RsV5g/441/Sorry I forgot to put the rowunselect event too. The details still same from above and since adding the rowunselect now the checkbox not selecting.
Here is the new jsfiddle:
http://jsfiddle.net/k1wsrwL9/44/Hello dan123,
Please, take a look at this example:
https://www.jseditor.io/?key=connection-between-grids-in-one-directionBest Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi Hristo,
One more small thing, I implemented using the custom checkbox column, whenever I click on the “Edit” button, it keeps the other rows as checked too. is there a way to remove other rows check marks once I click on the “Edit” button for that particular row.
here is my jsfiddle:
https://jsfiddle.net/UbK74/597/IN the first grid, on button click for a particular row it should show the detail for that row only. So for instance, when I click on row 1 button, it will show the detail for that row. But now when I click on row 2’s button, it should refresh and show only the detail for this row. Also I want to keep the logic for the multi selection using the checkbox column. Another thing, I wanted to mention where once I click on the button it will show the detail for that row and now suppose I clicked on the checkbox for that same row it should not create duplicate details.
Sorry here is the new jsfiddle:
https://jsfiddle.net/UbK74/680/Hi Hristo, I made the code smaller. I still need help with the information I posted in my previous reply please.
Here is the jsfiddle:
https://jsfiddle.net/UbK74/680/Wow. I got it cant believe it was simple.
add to ‘document’:
var selectFromMethod = false;
and function:
$('#jqxgrid').on('rowselect', function (event) { var rowBoundIndex = (event.args).rowindex; if (!selectFromMethod) { $('#jqxgrid').jqxGrid('clearselection'); selectFromMethod = true; $('#jqxgrid').jqxGrid('selectrow', rowBoundIndex); } selectFromMethod = false; });
-
AuthorPosts
You must be logged in to reply to this topic.