jQuery UI Widgets Forums Grid Select all event

This topic contains 5 replies, has 3 voices, and was last updated by  heer 2 years, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Select all event #71892

    aser
    Participant

    Hi, how can I get “select all” event, when the grid in ‘checkbox’ selection mode and “select all” checkbox is clicked?

    Thanks.

    Select all event #71896

    aser
    Participant

    UPD, actually, my grid works in virtual mode, and I need to select all rows only on current page by clicking “select all” checkbox

    Select all event #71898

    Dimitar
    Participant

    Hello aser,

    Here are two possible implementations of a “select all” event:

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Select all event #95838

    heer
    Participant

    Any ideas on how to implement the “unselect all”-event? The rowunselect-event does not fire when unselecting all rows by clicking the header-checkbox.

    Thanks in advance // Henrik

    Select all event #95852

    heer
    Participant

    Solved:

    The events “rowselect” and “rowunselect” does not really work as expected:

    rowselect fires
    1. When a row is selected
    2. When all rows are selected by clicking the “select-all-checkbox”
    3. When all rows are UNselected by clicking the “select-all-checkbox”.

    rowunselect fires
    1. When a row is unselected
    Note: rowunselect does NOT fire when all rows are unselected using the “select-all-checkbox”.

    Solution (using an un-documented feature):
    In the case “rowselect” was fired when clicking the “select-all-chenbox” the event-argument event.args.rowindex of the handler holds an array of indexes to the selected rows. i.e. an array of all indexes OR an empty array. By checking the length of the array you will know!

    Example:

    
        $("#theGrid").bind('rowselect', function (event) {
            if (Array.isArray(event.args.rowindex)) {
                if (event.args.rowindex.length > 0) {
                    alert("All rows selected");
                } else {
                    alert("All rows unselected");
                }
            } else {
                alert("Selected row has index = " + event.args.rowindex);
            }
        });
    
        $("#theGrid").bind('rowunselect', function (event) {
            alert("Unselected row has index = " + event.args.rowindex);
        });
    
    • This reply was modified 2 years, 6 months ago by  heer.
    • This reply was modified 2 years, 6 months ago by  heer. Reason: Formatting
    Select all event #95855

    heer
    Participant
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.