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.
-
Author
-
January 6, 2016 at 3:26 pm rowSelect event.args.row is undefined, but rowClick event.args.row is valid #80141
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
}
});January 6, 2016 at 3:55 pm rowSelect event.args.row is undefined, but rowClick event.args.row is valid #80144Hi 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 StoevjQWidgets Team
http://www.jqwidgets.com/January 6, 2016 at 8:44 pm rowSelect event.args.row is undefined, but rowClick event.args.row is valid #80156Hi 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
} -
AuthorPosts
You must be logged in to reply to this topic.