Hi,
Am new to kendo UI, so am not sure how I can do this task.
Problem: I have two data sources(Vtest.json file and Vdata.json file) that I want to populate in a single kendo grid. The grid is populated in such a way that the first three columns are populated from data.json file and the last column should be populated from Vtest.json file based on the first column in the grid. So I am trying to call a javascript function in the last column template in kendo grid. But am unable to filter the data and return the result to third column.
Here is the sample code:
var vDS = new kendo.data.DataSource({
transport: {
read: {
url: "/views/VTest.json",
dataType: "json"
}
}
});
//alert(JSON.stringify(vendorDS));
var nodeDS = new kendo.data.DataSource({
transport: {
read: {
url: "/views/Vdata.json",
dataType: "json"
}
},
pageSize: 1000
});
$("#gridAllRuns").kendoGrid({
dataSource: nodeDS,
groupable: true,
sortable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 10
},
filterable: {
extra: false,
operators: {
string: {
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
}
}
},
columns: [
{
title: "Node name",
field: "location",
template: "<a href=\"\">#= location.substr(7, location.length)#</a> ",
filterable: true
},
{
title: "UTC Date",
field: "date_UTC",
filterable: false
},
{
title: "Actual Value",
field: "wavg_bin_value1",
filterable: false
},
{
title: "Vendor",
field: "",
template: "#= getVendor(location) #",
filterable: true
}
]
})
//my javascript function....
function getVendor(location) {
var node = location.substr(7, location.length);
vDS.filter({ field: "node", operator: "eq", value: node });
return vDS.view()[0].Vndr;
}
Am new to kendo UI, so am not sure how I can do this task.
Problem: I have two data sources(Vtest.json file and Vdata.json file) that I want to populate in a single kendo grid. The grid is populated in such a way that the first three columns are populated from data.json file and the last column should be populated from Vtest.json file based on the first column in the grid. So I am trying to call a javascript function in the last column template in kendo grid. But am unable to filter the data and return the result to third column.
Here is the sample code:
var vDS = new kendo.data.DataSource({
transport: {
read: {
url: "/views/VTest.json",
dataType: "json"
}
}
});
//alert(JSON.stringify(vendorDS));
var nodeDS = new kendo.data.DataSource({
transport: {
read: {
url: "/views/Vdata.json",
dataType: "json"
}
},
pageSize: 1000
});
$("#gridAllRuns").kendoGrid({
dataSource: nodeDS,
groupable: true,
sortable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 10
},
filterable: {
extra: false,
operators: {
string: {
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
}
}
},
columns: [
{
title: "Node name",
field: "location",
template: "<a href=\"\">#= location.substr(7, location.length)#</a> ",
filterable: true
},
{
title: "UTC Date",
field: "date_UTC",
filterable: false
},
{
title: "Actual Value",
field: "wavg_bin_value1",
filterable: false
},
{
title: "Vendor",
field: "",
template: "#= getVendor(location) #",
filterable: true
}
]
})
//my javascript function....
function getVendor(location) {
var node = location.substr(7, location.length);
vDS.filter({ field: "node", operator: "eq", value: node });
return vDS.view()[0].Vndr;
}