ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: rgorantla on January 05, 2015, 09:11:40 pm
-
Hi,
Happy New Year!
I have JSON data returning text and value - how do i display text in dropdowns ? I also need value of it but hidden
-
Happy new Year to you as well.
Please check the Shipping Via column in this demo http://paramquery.com/pro/demos/editing_custom
Possible formats of JSON data are mentioned in the API
http://paramquery.com/pro/api#option-column-editor
-
Hi,
Thank you !
could you please provide me an example for JSON data
-
Please check ShipVia column in http://paramquery.com/pro/demos/editing_custom
editor: {
type: 'select',
options: [{ '': '' }, { 'SE': 'Speedy Express' }, { 'UP': 'United Package' }, { 'FS': 'Federal Shipping'}]
}
or
editor: {
type: 'select',
valueIndx: 'id',
labelIndx: 'text',
options: [{ id: 'SE', text: 'Speedy Express' }, { id: 'UP', text: 'United Package' }, {id: 'FS', text: 'Federal Shipping'}]
}
-
Hi,
Please see the code below : I still dont see the values.. Can you please correct whats wrong in this?
function clientsauto() {
var jst;
$.getJSON(clientslink, function (data) {
var o = _.object(_.map(data, function (x) { return [x.Value, x.Text] }));
jst = JSON.stringify(data);
console.log(jst); // jst has [{"Text":"Select a Client","Value":"0"},{},{..}]
return jst;
});
}
editor: {
type: "select",
options: clientsauto,
getData: function (ui) {
return ui.$cell.find("select").val()
}
},
render: function (ui) {
var options = ui.column.editor.options,
cellData = ui.cellData;
for (var i = 0; i < options.length; i++) {
var option = options;
if (option[cellData]) {
return option[cellData];
}
}
},
-
your callback is asynchronous function, you haven't mentioned valueIndx, labelIndx in the editor definition and your render callback is incorrect for the JSON format.
Please check the ShipVia column in this example:
http://paramquery.com/pro/demos/editing_custom2