mzeddd
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« on: March 18, 2014, 06:19:11 AM » |
|
Hi,
Is it possible to use CTRL function key to enable multiple select in datagrid?
I mean Datagrid should allow multiple select only when CTRL key is pressed by user. And I'm talking about mouse click on a row.
But multiple select should work as it is when user clicks on checkbox. //V
|
|
« Last Edit: March 18, 2014, 07:09:16 AM by mzeddd »
|
Logged
|
|
|
|
stworthy
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #1 on: March 18, 2014, 08:54:03 PM » |
|
The new 'ctrlSelect' property will be added in next version, which only allows multi-selection when ctrl+click is used. To use this feature, please download the updated datagrid plugin from http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js and include it to your page. Remember to set 'ctrlSelect' property to true.
|
|
|
Logged
|
|
|
|
mzeddd
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #2 on: March 18, 2014, 11:42:24 PM » |
|
Perfect. This is what I've been waiting for!
But when I load my page in Firefox in console I have the following error:
[10:38:56.803] opts.finder.getRows is not a function @ jquery.datagrid.js:1174
|
|
|
Logged
|
|
|
|
stworthy
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #3 on: March 19, 2014, 12:52:36 AM » |
|
Please refer to the attached example 'test.html'. It works fine.
|
|
|
Logged
|
|
|
|
mzeddd
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #4 on: March 19, 2014, 03:06:30 AM » |
|
Hi. It seems like this error comes from ComboGrid when updated datagrid plugin is used. See attached file ---------- Update: Updated datagrid plugin interfere with ComboGrid when pure 1.3.5 version is used. When I change <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="jquery.easyui.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js"></script>
to <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js"></script> It starts to work again.
|
|
« Last Edit: March 19, 2014, 03:14:38 AM by mzeddd »
|
Logged
|
|
|
|
stworthy
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #5 on: March 19, 2014, 07:39:50 AM » |
|
When using combo grid, please extend the 'getRows' for $.fn.combogrid.defaults.finder. $.extend($.fn.combogrid.defaults.finder, { getRows: function(target){ return $(target).datagrid('getRows'); } })
Another way to solve this issue is to include the combogrid together with datagrid. <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="jquery.easyui.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/plugins/jquery.combogrid.js"></script>
|
|
|
Logged
|
|
|
|
mzeddd
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #6 on: March 21, 2014, 12:00:54 AM » |
|
Hi stworthy,
Thank you for this workarounds.
I have one note to updated datagrid plugin: For example I have datagrid with "singleSelect:false,ctrlSelect:true,pagination:true" options. 1) When I click on a row, I get it selected - Good 2) When I click on another row, I get new row selected. 1st one gets not selected - Good 3) When I click on next row with CTRL. New row gets selected and 2nd row stays selected - Good 4) When I click on 4th row. The 4th row gets selected and #2, #3 rows get not selected - Good 5) I switch to next page. I get new data in datagrid - Good 6) When I click on 1st row in page 2 I get two rows selected: row #4 in page 1 and row #1 on page 2 - Not good
I think in step 6 I have to have one row selected and it should be on page 2.
|
|
|
Logged
|
|
|
|
|
mzeddd
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #8 on: March 21, 2014, 02:18:44 AM » |
|
Seems like 'ctrlSelect' feature stoped working with latest plugin. - i don't know what happend, but now it is working.
But still one note: Lines on 1st page are not selected anymore when I click on any row on next page but checkboxes (I have it as 1st column) remain set.
|
|
« Last Edit: March 21, 2014, 03:10:23 AM by mzeddd »
|
Logged
|
|
|
|
stworthy
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #9 on: March 21, 2014, 06:15:15 AM » |
|
Please override the 'clearSelections' and 'clearChecked' methods of datagrid to solve this issue. $.extend($.fn.datagrid.methods, { clearSelections: function(jq){ return jq.each(function(){ var state = $.data(this, 'datagrid'); var selectedRows = state.selectedRows; var checkedRows = state.checkedRows; selectedRows.splice(0, selectedRows.length); $(this).datagrid('unselectAll'); if (state.options.checkOnSelect){ checkedRows.splice(0, checkedRows.length); } }); }, clearChecked: function(jq){ return jq.each(function(){ var state = $.data(this, 'datagrid'); var selectedRows = state.selectedRows; var checkedRows = state.checkedRows; checkedRows.splice(0, checkedRows.length); $(this).datagrid('uncheckAll'); if (state.options.selectOnCheck){ selectedRows.splice(0, selectedRows.length); } }); } })
|
|
|
Logged
|
|
|
|
Pierre
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #10 on: March 23, 2014, 11:59:55 AM » |
|
Hello I try to use ctrlSelect in the combination with dragDrop but it looks like it does not work. When I remove ctrlSelect, dragDrop works OK. Thanks.
|
|
|
Logged
|
|
|
|
Pierre
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #11 on: March 26, 2014, 01:01:40 AM » |
|
Hello stworthy could you please check ctrlSelect when enableDnd is used on grid? Here it does not working together.
I need that user can select few rows (using ctrlSelect) and drag and drop them all to other grid. Is that possible?
Thank you
|
|
« Last Edit: March 26, 2014, 01:04:31 AM by Pierre »
|
Logged
|
|
|
|
|
Pierre
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #13 on: March 26, 2014, 06:04:47 AM » |
|
OK thanks. There is no way that I use those example to drag multiple rows from one grid to other ![Angry](http://jeasyui.com/forum/Smileys/default/angry.gif) Maybe you can write some simple example and put them into Examples section? ![Grin](http://jeasyui.com/forum/Smileys/default/grin.gif)
|
|
|
Logged
|
|
|
|
Pierre
|
![](https://jeasyui.com/forum/Themes/default/images/post/xx.gif) |
« Reply #14 on: April 08, 2014, 12:51:05 AM » |
|
OK thanks. There is no way that I use those example to drag multiple rows from one grid to other ![Angry](http://jeasyui.com/forum/Smileys/default/angry.gif) Maybe you can write some simple example and put them into Examples section? ![Grin](http://jeasyui.com/forum/Smileys/default/grin.gif) Hello stworthy any chance that you write some example of how to use drag/drop using ctrl? I simply can not achieve that, Thank you.
|
|
|
Logged
|
|
|
|
|