Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
igGrid bound to REST service url
posted

Hello,

I have an igGrid set up as the following:

window.onload = function(){
var numbers = ["0", "1", "2", "3", "4", "5", "6"];
// var dataURL = "The url of a REST service that returns data in the same form as 'data' below";
var data = [
{
"Description": "Poly over pack drum with wheels contents lavel picture and ID number",
"Quantity": "1",
"TIDnumber": "8281452"
},
{
"Description": "55 gallon steel ring top drum",
"Quantity": "1",
"TIDnumber": "8281451"
}];
$("#grid").igGrid({
virtualization: false,
autoGenerateColumns: false,
renderCheckboxes: true,
primaryKey: "TIDnumber",
columns: [{
// note: if primaryKey is set and data in primary column contains numbers,
// then the dataType: "number" is required, otherwise, dataSource may misbehave
headerText: "TIDnumber", key: "TIDnumber", width:"10%", dataType: "number"
},
{
headerText: "Description", key: "Description", width: "70%", dataType: "string"
}, {
headerText: "Quantity", key: "Quantity", width: "10%", dataType: "string"
}, {
headerText: "Amount Needed", key: "AmountNeeded", width: "10%", dataType: "string", unbound: true
}
],
dataSource: data, //JSON Array defined above //where i have been putting dataURL
dataRendered: function (evt, ui) {
ui.owner.element.find("tr td:nth-child(1)").css("text-align", "center");
ui.owner.element.find("tr td:nth-child(2)").css("text-align", "left");
ui.owner.element.find("tr td:nth-child(3)").css("text-align", "center");
ui.owner.element.find("tr td:nth-child(4)").css("text-align", "center");
},
dataSourceType: "json",
width: "100%",
tabIndex: 1,
features: [
{
name: 'Responsive',
enableVerticalRendering: false,
columnSettings: [
{
columnKey: 'TIDnumber',
classes: 'ui-hidden-phone'
},
{
columnKey: 'Description',
classes: 'ui-hidden-phone'
},
{
columnKey: 'Quantity',
classes: 'ui-hidden-phone'
},
{
columnKey: 'AmountNeeded',
classes: 'ui-hidden-phone'
}
]
},
{
name: "Selection",
mode: "row"
},
{
name: "Updating",
enableAddRow: false,
editMode: "rowedittemplate",
rowEditDialogWidth: 280,
rowEditDialogHeight: '280',
rowEditDialogContentHeight: 300,
rowEditDialogFieldWidth: 150,
rowEditDialogContainment: "window",
rowEditDialogRowTemplateID: "rowEditDialogRowTemplate1",
enableDeleteRow: false,
showReadonlyEditors: false,
showDoneCancelButtons: true,
enableDataDirtyException: true,
columnSettings: [
{
columnKey: "TIDnumber",
readOnly: true
}, {
columnKey: "Description",
readOnly: true
},
{
columnKey: "Quantity",
readOnly: true
},
{
columnKey: "AmountNeeded",
editorType: "text",
editorOptions: {
button: "dropdown",
listItems: numbers,
readOnly: true,
dropDownOnReadOnly: true
}
}
]
}
]
});
}

for some reason the Grid will bind to the variable data but not dataURL even though the data that is returned from that URL is the same formatting as the data variable.

Any help would be greatly apprectiated,

Thanks!

Jake :)

Parents Reply Children
No Data