EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: MFS on December 05, 2017, 07:39:46 AM



Title: Problem with datagrid and getSelections
Post by: MFS on December 05, 2017, 07:39:46 AM
Hello.
I am trying to use: var fields= $('#grdTable').datagrid('getSelections');
After I do:
alert(fields);
I recive next message: [object Object],[object Object]

How to get, for sample: 1,2


Title: Re: Problem with datagrid and getSelections
Post by: jarry on December 05, 2017, 07:04:39 PM
The 'getSelections' returns an array that contains the selected rows. You should convert it to string value. Please refer to the code below:
Code:
var rows = $('#grdTable').datagrid('getSelections');
var ids = $.map(rows, function(row){return row.id});
var str = join(',', ids);
console.log(str);