jQWidgets Forums
jQuery UI Widgets › Forums › Grid › new checkbox selection
Tagged: grid checkbox selection
This topic contains 3 replies, has 3 voices, and was last updated by kozyrskyi 11 years, 9 months ago.
-
Authornew checkbox selection Posts
-
I just saw that checkbox selection for row selection. Is there an example of this passing a specific column value as the id for all selected rows on a button click or something similar? I want to get a hidden ID value for each row selected.
Thanks,
RoyHi Roy,
The “getcellvalue” method can return value of any cell in the Grid – hidden or not.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comDo you have an example of returning the selected rows?
Hello,
I was trying get selected rows by checkbox selection.var rowindexes = $(“#jqxgridStreet”).jqxGrid(‘getselectedrowindexes’);
But, it returns empty array, when enable filter on grid. Without filter, it’s returning an array of indexes.
var sourceStreet =
{
datatype: “json”,
datafields: [
{ name: ‘id’ },
{ name: ‘city’ },
{ name: ‘name’ }
],
async: false,
url: “/streets.json”,
root: ‘streets’,
pagenumb: 1,
beforeprocessing: function(data) {
var paginator = data[‘paginator’];
sourceStreet.totalrecords = paginator[‘total’];
sourceStreet.pagenum = paginator[‘page_number’];
},
filter: function () {
$(“#jqxgridStreet”).jqxGrid(‘updatebounddata’);
},
sort: function () {
$(“#jqxgridStreet”).jqxGrid(‘updatebounddata’);
}
};
var dataAdapterStreet = new $.jqx.dataAdapter(sourceStreet);
$(“#jqxgridStreet”).jqxGrid(
{
source: dataAdapterStreet,
width: ‘100%’,
theme: theme,
sortable: true,
selectionmode: ‘checkbox’,
filterable: true,
showfilterrow: true,
rendergridrows: function() { return dataAdapterStreet.records; },
columns: columns = [
{ text: ‘ID’, datafield: ‘id’, width: ‘15%’ },
{ text: ‘City’, datafield: ‘city’, width: ‘35%’},
{ text: ‘Name’, datafield: ‘name’, width: ‘50%’},
],
pageable: true,
virtualmode: true
});$(“#createStreet”).on(‘click’, function (event) {
var rowindexes = $(“#jqxgridStreet”).jqxGrid(‘getselectedrowindexes’);
var city = null;
$(‘#newStreetListBlock’).empty();
for (var i=0; i < rowindexes.length; i++) {
var datarow = $("#jqxgridStreet").jqxGrid('getrowdata', rowindexes[i]);
if ((city) && (city != datarow['city'])) {
alert('Error. Different cities.');
return false;
}
else {
city = datarow['city'];
var hidden_street = $("”);
$(‘#newStreetListBlock’).append(hidden_street);
}
}
$(“#streetform”).submit();
});Thanks, Max.
-
AuthorPosts
You must be logged in to reply to this topic.