ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: precator on October 29, 2013, 05:09:26 am
-
Is there any way to link to a url from say an id column? like instead of just having the number I would like it linkable to say a details page and pass the id in..
-
You need to use this callback
http://paramquery.com/api#option-column-render (http://paramquery.com/api#option-column-render)
-
Can you provide an example where I just prepend text and append at the end?
like I want to create a url link from the id field. I see there is a render function but no example on how to do that..
I see there is this >> function( ui ){}; << but not sure what to do with that..
-
There is an example on how to use render callback:
http://paramquery.com/demos/render_cells (http://paramquery.com/demos/render_cells)
-
whenever I try to access an index or rowData I get an undefined.. Attaching the code.. Any idea what is wrong? I put the render function in the colModel.
var colM = [
{
title: "OrderID", dataIndx: "OrderID", width: 100, render: function (ui) {
var rowData = ui.rowData;
return "textbefore" + rowData[1] + "textafter" ;
}
},
{ title: "CustomerName", dataIndx: "CustomerName", width: 130 },
{ title: "UnitPrice", dataIndx: "UnitPrice", width: 100, align: "right",dataType: "float" },
{ title: "OrderDate", dataIndx: "OrderDate", width: 100 }
];
-
your dataIndx are strings, so I assume that you are using JSON data.
your render callback would be
render: function (ui) {
var rowData = ui.rowData;
return "textbefore" + rowData["OrderID"] + "textafter" ;
}
-
Perhaps this is what you are looking for:
var colModel = [
{ title: "Employee name", width: 200, dataType: "string", dataIndx: "EmployeeName" },
{ title: "Hired on", width: 150, dataType: "string", dataIndx: "DateTimeHired", render: function (ui) {
var cellData = ui.rowData[this.dataIndx];
if (cellData) {
// Convert JSON DateTime e.g. /Date(2176326711)/ to yyyy-mm-dd format
return deserializeJSONDateTime(cellData);
}
}
];