jQWidgets Forums

jQuery UI Widgets Forums TreeGrid rowSelect event.args.row is undefined, but rowClick event.args.row is valid

This topic contains 2 replies, has 2 voices, and was last updated by  jqxfidqs 9 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • jqxfidqs
    Participant

    Hi JQX Team,

    We are using jQWidgets v3.9.1 (2015-Oct)

    I have a TreeGrid loaded with data grouped by one Data Column.

    When I select any Child row, rowSelect Event is returning valid event.args.row object.
    But when I select a Parent row, rowSelect event.args.row is always undefined.

    rowClick event is returning valid row object for both Child and Parent rows, but we do not want to restrict user to Click only action.

    Can someone please take a look and help us? Thank you

    //TreeGrid declaration

    $(“#jqxGridJobCycles”).jqxTreeGrid(
    {
    width: 450,
    height: 550,
    source: dataAdapterJobCycles,
    columnsHeight: 35,
    sortable: false,
    ready: function () {
    $(“#jqxGridJobCycles”).jqxTreeGrid(‘expandAll’);
    },

    columns: [
    { text: ”, dataField: ‘CycleName’, width: 400, cellsalign: ‘left’, align: ‘center’ }
    ]
    });

    //rowSelect Event handler
    $(‘#jqxGridJobCycles’).on(‘rowSelect’,
    function (event)
    {
    var args = event.args;
    var row = args.row; // args.row always undefined for Parent Rows only
    var key = args.key;
    });

    //rowClick Event handler
    $(‘#jqxGridJobCycles’).on(‘rowClick’,
    function (event)
    {
    var args = event.args;
    var row = args.row;
    var key = args.key;
    });

    //Data Source & DataAdapter

    var sourceJobCycles = {
    datatype: “json”,
    datafields: [
    { name: ‘CategoryType’, type: ‘string’ },
    { name: ‘CycleType’, type: ‘string’ },
    { name: ‘CycleCode’, type: ‘string’ },
    { name: ‘CategoryTypeDesc’, type: ‘string’ },
    { name: ‘CycleName’, type: ‘string’ },
    { name: ‘CycleColor’, type: ‘string’ }
    ],
    hierarchy:
    {
    groupingDataFields: [{name: “CategoryTypeDesc”}],
    },
    id: ‘CycleCode’,
    url: getJobCyclesUrl,
    data: {
    “categoryType”: ‘OPSORDUPLOAD’,
    “dateType” : dtType,
    “asOfDate”: month + ‘/’ + day + ‘/’ + year,
    },
    async: true
    };

    var dataAdapterJobCycles = new $.jqx.dataAdapter(sourceJobCycles, {
    downloadComplete: function (data, status, xhr) {
    },
    loadComplete: function (data) {
    var length = dataAdapterJobCycles.records.length;
    LogMessage(“I”, “Data: length => ” + length);
    },
    loadError: function (xhr, status, error) {
    //Log Error
    }
    });


    Peter Stoev
    Keymaster

    Hi jqxfidqs,

    We will test this and if we reproduce it we will create a work item for future release. If that’s an issue for you, you may not use the event.args, use the TreeGrid’s methods for getting the row.

    Best Regards,
    Peter Stoev

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


    jqxfidqs
    Participant

    Hi Peter,

    Based on your suggestion, using the methods now to get row data. Thank you.

    //set selectionMode to singleRow And

    var selection = $(“#jqxGridJobCycles”).jqxTreeGrid(‘getSelection’);
    for (var i = 0; i < selection.length; i++) {
    var rowData = selection[i];
    }

    if (rowData.level == 0) //Parent Row
    {
    category = rowData.data.CategoryType;
    }
    else // child rows
    {
    var args = event.args;
    var row = args.row;
    category = row.CategoryType
    }

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

You must be logged in to reply to this topic.