jQWidgets Forums

jQuery UI Widgets Forums Grid Row- and Cell-Selection combined

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Row- and Cell-Selection combined #54788

    tkujawa
    Participant

    Hey guys,

    is it possible in some way to use cell and row selection combined? I´m working on a customer project and this behavior is required. The table should have a excel like feeling with the keyboard on cells so I set selectionmode: 'multiplecelladvanced'. Additonally it have to be possible to select a row via a checkbox in the first column. I tried some workarounds e.g. rowselect in cellendedit method but nothing worked. Also adding the classes jqx-grid-cell-selected jqx-fill-state-pressed didn’t work well, because if I scroll after this way of selecting the row, the selection disappears. Probably because the table doesn’t get the selection info intern.

    I hope I explained my problem coherent. Any solutions from your side?

    Thanks!

    Row- and Cell-Selection combined #54791

    Peter Stoev
    Keymaster

    Hi tkujawa,

    Unfortunately, it is not possible to combine selection modes.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Row- and Cell-Selection combined #54799

    tkujawa
    Participant

    Hi Peter,

    thanks for your quick response! That’s a pity, but maybe I can build a little workaround for my case. I wrote the following to select a row respectively multiple rows if clicked the checkbox in my first column:

    $('#myGrid').on('cellendedit', function (event) {
        var args = event.args;
    
        if ( args.datafield == "Selected" ) {
            if ( args.value == true ) {
    
                // Select row - Grid Core
                $('#myGrid').jqxGrid('selectrow', args.rowindex);
    
                var selectedRows = $('#myGrid').jqxGrid('getselectedrowindexes');
    
                // Select rows - UI
                _.each(selectedRows, function(value) {
    
                   $('#myGrid').find('#row' + value + 'table-widget').find('.jqx-grid-cell').addClass('jqx-grid-cell-selected jqx-fill-state-pressed');
    
                });
    
            } else {
                // Nothing for the moment
            }
        }
    
    });

    The table still has selectionmode: 'multiplecellsadvanced' and this code works very well, but if I scroll or clicking somewhere else in the grid, the selection disappears and I don’t know which event is fired in this case. Could you please tell me the events or explain what’s happening on these actions? I feel pretty close to a passable workaround solution 🙂

    Thanks and regards,
    Timo

    Row- and Cell-Selection combined #54908

    kuberasamrat
    Participant

    Hi Peter,

    Suggest any alternative which can make sure of using check box selection mode as well as selecting the cell individually.

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

You must be logged in to reply to this topic.