selectedRow returns null
New DiscussionHi! I’ve been researching a lot to find my problem but didn’t find the solution. I hope you can help me.
This is my js code:
$(document).ready(function () {
$("#mainTable").igGrid({
autoGenerateColumns: false,
dataSource: dataTable, //introduce the JSON array with data
autoCommit: false,
columns: [ //the keyword in igGrid for defining the columns
{ headerText: "System Table", key: "SysTableName", dataType: "string" },
{ headerText: "Created by", key: "CreatorUser", dataType: "string" },
{ headerText: "Table Name", key: "TableName", dataType: "string" },
{ headerText: "Number of Columns", key: "ColumnsNumber",
dataType: "number", width: '10%' },
{ headerText: "Column Type", key: "ColumnType", dataType: "string" },
{ headerText: "Length", key: "Length", dataType: "number" },
{ headerText: "Nulls", key: "AreNulls", dataType: "string", width: '5%' },
{ headerText: "Updates", key: "Updates", dataType: "string", width: '5%' },
{ headerText: "Remarks", key: "Remarks", dataType: "string" },
{ headerText: "Scale", key: "Scale", dataType: "number" }
],
features: [
{ name: "Filtering" },
{ name: "GroupBy", columnSettings: [
{ columnKey: "TableName", allowGrouping: false }]},
{ name: "Sorting", type: "local" },
{ name: "Paging", type: "local", position: "top", pageSize: 20 },
{ name: "Selection", persist: false, mode: 'row', multipleSelection: false,
rowSelectionChanging: handler, mouseDragSelect: false, touchDragSelect: false }
],
width: '100%'
});
function handler(event, args) {
//THIS RETURNS NULL (row == NULL)
var row = $("#mainTable").igGridSelection("selectedRow");
if (!row) {alert("row is null");} //just a test
//THIS WORKS JUST FINE, but needs non-fixed row index
//var cellContent = $("#mainTable").igGrid("getCellValue", 10, "TableName");
} //end handler() });
My intention is to get the content of a certain cell
once I select the row.
That method, commented in my code, works just fine,
but I can’t get the “selectedRow” method
to work, so I can use the index property in row.
I wonder what I’m not doing right, but I can’t seem to find it.
Thank you for your help.
Regards.
Sign In
to post a reply
Replies
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Favorites
0 Replies
2 Created On
Jul 01, 2016 Last Post
9 years, 8 months ago