EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: ndtdnc on February 20, 2015, 07:55:31 AM



Title: Datagrid selected rows
Post by: ndtdnc on February 20, 2015, 07:55:31 AM
Dear,

I have datagrid with checkbox. So i want to do as below
if i selected one row have one panel 1 show.
if i selected 2 rows or more, have panel 2 show and panel 1 hide.

I think about count many rows selected, but i just use easyui, so i need your help.

Plz help me,
thank you!


Title: Re: Datagrid selected rows
Post by: stworthy on February 20, 2015, 05:46:15 PM
You can call 'getSelections' method to check the selected rows count.
Code:
$('#dg').datagrid({
    onSelect: function(index,row){
        var count = $(this).datagrid('getSelections').length;
        console.log(count)
    }
})


Title: Re: Datagrid selected rows
Post by: ndtdnc on February 21, 2015, 01:07:18 AM
Yeah. I mean that. And it worked.
Thank mate. :D