var rows = $('#dg').datagrid('getChecked'); var ids = ''; for (var i = 0; i < rows.length; i++) { ids += rows[i].id + ','; } ids = ids.substring(0, ids.length - 1);