Hi,
I have a table that i am creating with code, ie:
$('#users').datagrid({
title : 'Users',
iconCls : 'icon-user',
width : '100%',
height : 'auto',
nowrap : true,
striped : true,
collapsible : false,
url : "/getUsers",
sortName : 'userId',
loadMsg: 'Loading data form server..',
sortOrder : 'desc',
remoteSort : true,
idField : 'userId',
doSize:true,
fit:true,
columns : [ [ {
title : 'User ID',
field : 'userId',
width : 60,
sortable : true
}, {
field : 'username',
title : 'Username',
width : 90,
rowspan:2,
sortable : true,
sorter : function(a, b) {
return (a > b ? 1 : -1);
}
} , {
field : 'name',
title : 'Name',
width : 350,
rowspan:2,
sortable : true,
sorter : function(a, b) {
return (a > b ? 1 : -1);
}
} ] ],
pagination : true,
rownumbers : true
});
I then have a button that when you click on it calles this function:
function getSelections(){
var ids = [];
var rows = $('#users').datagrid('getSelections');
for(var i=0;i<rows.length;i++){
ids.push(rows[i].id);
alert(ids[i]);
}
}
However no matter how many rows i select, the rows variable only shows me 1 selection (the last one i choose).
Here is the html of my table:
<table id="users" maximizable="false" toolbar="#userSearchtb"></table>