Hi,
I'm looking to render a column output but I get the error "dt is undefined" if I write:
render: function( ui ){ var dt = ui.text; return dt.substring(0,8); }
or the error: "ui.text is undefined" if I write:
render: function( ui ){ ui.text.substring(0,8); }
but I have no error if I write:
render: function( ui ){ ui.text; }
or
render: function( ui ){ var dt = 'abcd1234567890'; return dt.substring(0,4)+':'+dt.substring(4,8); }
Thank you
$(function () {
var data = [[1, 'Exxon Mobil', '20160219.001', '339,938.0', '36,130.0'],
[2, 'Wal-Mart Stores', '20160210.002', '315,654.0', '11,231.0'],
[39, 'Royal Dutch Shell', '20160210.001', '306,731.0', '25,311.0'],
[19, 'Crédit Agricole', '20160213.001', '110,764.6', '7,434.3'],
[20, 'American Intl. Group', '20160228.001', '108,905.0', '10,477.0']];
var obj = {
scrollModel: {autoFit: true},
height: 400,
colModel: [
{ title: "Rank", width: 100, dataType: "integer" },
{ title: "Company", width: 200, dataType: "string"},
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ return ui.rowData[2].substring(0,4); } },
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ var dtx = ui.rowData[ui.rowData.rowIndx]; return dtx.substring(0,4); } },
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ return ui.rowData[ui.rowData.rowIndx].substring(0,4); } },
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ return ui.rowData[ui.rowData.rowIndx].substr(0,4) } }, //ERROR ->
// { title: "Date", width: 100, dataType: "string", render: function( ui ){ var dt = 'abcd1234567890'; return dt.substring(0,4)+':'+dt.substring(4,8); } },
{ title: "Date", width: 100, dataType: "string", render: function( ui ){ var dt = ui.text; return dt.substring(0,4)+':'+dt.substring(4,8); } },
{ title: "Revenues ($ millions)", width: 180, dataType: "float" },
{ title: "Profits ($ millions)", width: 180, dataType: "float" }
],
dataModel: {
data: data,
sortIndx: 1,
sortDir: "up"
}
};
$("#grid_custom_sorting").pqGrid(obj);
});