jQWidgets Forums

jQuery UI Widgets Forums Grid new checkbox selection

This topic contains 3 replies, has 3 voices, and was last updated by  kozyrskyi 11 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • new checkbox selection #28603

    rharding98
    Participant

    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,
    Roy

    new checkbox selection #28619

    Peter Stoev
    Keymaster

    Hi Roy,

    The “getcellvalue” method can return value of any cell in the Grid – hidden or not.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    new checkbox selection #28692

    rharding98
    Participant
    new checkbox selection #28717

    kozyrskyi
    Member

    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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.