I had been trying a lot to get adding filter in ajax (razor view)
Please someone helps me ... i am new and so much need your helps
Thank you so much...
i tried this one.
$.ajax({
contentType: "json",
url: url,
method: 'GET',
success: function (d) {
// var dropdownpropertyvalue = $("#dropdownproperty").val(selectedIndex);
var grid = $("#GridProperty").data("kendoGrid");
// grid.autoBind(false);
//grid.ajax();
grid.dataSource = new kendo.data.DataSource({ data: d });
// grid.filter(filter.add({field: "EntityName", operator: "Contains", value: entityName}));
grid.dataSource.read();
// grid.serverFiltering(true);
grid.dataSource.filter({ field: "EntityName", operator: "eq", value: dropdownpropertyvalue });
grid.refresh();
}
});
}
(not working here grid.dataSource.filter({ field: "EntityName", operator: "eq", value: dropdownpropertyvalue });)
In kendo, i can do like this for filter....
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Filter(filter => {
filter.Add(p => p.EntityName).Contains(@ViewData["FirstEntity"].ToString());
})
.Model(x =>
{
x.Id(y => y.Id);
x.Field(y => y.EntityName).Editable(false);
x.Field(y => y.PropertyName).Editable(false);
x.Field(y => y.Description).Editable(false);
})
.Read(read => read.Action("PropertiesRead", "Properties",new {toolId=1}))
.Update(update => update.Action("OperationsUpdate", "Operations",new {toolId=1}))
and how to apply here tooId = (from js variable)?
Please someone helps me ... i am new and so much need your helps
Thank you so much...
i tried this one.
$.ajax({
contentType: "json",
url: url,
method: 'GET',
success: function (d) {
// var dropdownpropertyvalue = $("#dropdownproperty").val(selectedIndex);
var grid = $("#GridProperty").data("kendoGrid");
// grid.autoBind(false);
//grid.ajax();
grid.dataSource = new kendo.data.DataSource({ data: d });
// grid.filter(filter.add({field: "EntityName", operator: "Contains", value: entityName}));
grid.dataSource.read();
// grid.serverFiltering(true);
grid.dataSource.filter({ field: "EntityName", operator: "eq", value: dropdownpropertyvalue });
grid.refresh();
}
});
}
(not working here grid.dataSource.filter({ field: "EntityName", operator: "eq", value: dropdownpropertyvalue });)
In kendo, i can do like this for filter....
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Filter(filter => {
filter.Add(p => p.EntityName).Contains(@ViewData["FirstEntity"].ToString());
})
.Model(x =>
{
x.Id(y => y.Id);
x.Field(y => y.EntityName).Editable(false);
x.Field(y => y.PropertyName).Editable(false);
x.Field(y => y.Description).Editable(false);
})
.Read(read => read.Action("PropertiesRead", "Properties",new {toolId=1}))
.Update(update => update.Action("OperationsUpdate", "Operations",new {toolId=1}))
and how to apply here tooId = (from js variable)?