jQWidgets Forums

jQuery UI Widgets Forums TreeGrid Column index tree grid

This topic contains 3 replies, has 2 voices, and was last updated by  lenaykt 9 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Column index tree grid #76997

    lenaykt
    Participant

    Hi everyone,

    Is there any method to get column number on row click? I am trying to simulate cell click event with:

    $(‘#treeGrid’).on(‘click’, ‘td’, function(){
    $(this).removeClass(‘jqx-grid-cell-selected’);
    }).

    I know it is not a good way of doing it but I have no another ideas at the moment…
    I use conditional formatting for my cells exactly as shown in demo. so when I click on td it removes that jqx class. And if I click on another cell in the same row it adds back removed class in the previously selected cell and removes from currently selected cell. I have also 4 buttons next/previous cell and row. So my question is how to get selected with mouse cell index when I click on next/prev cell? I tried to do it with a global variable but so far no luck…

    Column index tree grid #77002

    ivailo
    Participant

    Hi lenaykt,

    You can get info about clicked column with rowClick event:

    $('#treeGrid').on('rowClick', 
    function (event)
    {
        // event args.
        var args = event.args;
        // row data.
        var row = args.row;
        // row key.
        var key = args.key;
        // data field
        var dataField = args.dataField;
        // original click event.
        var clickEvent = args.originalEvent;
    });

    You can get selected rows with getSelection:

    var selection = $("#table").jqxTreeGrid('getSelection');
    for (var i = 0; i < selection.length; i++) {
        // get a selected row.
    	var rowData = selection[i];
    }

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    Column index tree grid #77063

    lenaykt
    Participant

    Hi ivailo, thanks.

    Yes, you can get it with the originalEvent. My question is how can I get already selected row column’s value?

    $('#nextCellButton').on('click',function(){
      var selectedItem = $('treeGrid').jqxTreeGrid('getSelection');
      var selectedRow =  $('treeGrid').jqxTreeGrid('getRow',selectedItem[0].ID);
      var selectedCell = ??
    });
    

    Regards,
    lenaykt.

    Column index tree grid #77077

    lenaykt
    Participant

    I found my mistake. The issue is solved.

    Thanks,
    Elena.

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

You must be logged in to reply to this topic.