We want to build a grid having google like filtering, is it possible and what is the best way to wrap the code around the current kendo ui grid to accomplish this? TIA.
e.g.
ASP.NET Ajax Grid Google Like Filtering
e.g.
ASP.NET Ajax Grid Google Like Filtering
4 Answers, 1 is accepted
0
Hi Sang,
Yes such behavior could be achieved with the Kendo Grid. You need to create different ComboBoxes in each of the column header templates and attach Change handlers to the comboboxes.
For example:
And the following Change handler:
I hope this helps.
Regards,
Petur Subev
the Telerik team
Yes such behavior could be achieved with the Kendo Grid. You need to create different ComboBoxes in each of the column header templates and attach Change handlers to the comboboxes.
For example:
columns.Bound(
"ProductName"
).Sortable(
false
).HeaderTemplate(@<text>
@(Html.Kendo().ComboBox().Name(
"cProducts"
)
//you can use ajax binding if you preffer
//.DataSource(ds=>ds.Read(rea=>rea.Action("GetProducts","Home")))
.BindTo(
new
List<
string
>{
"Chang"
,
"test2"
})
//or direct populate on the server
.Events(ev=>ev.Change(
"onComboProductChange"
))
)
</text>);
<script type=
"text/javascript"
>
function
onComboProductChange(e) {
if
(
this
.value()) {
$(
'#Grid'
).data(
'kendoGrid'
).dataSource.filter(
{ field:
"ProductName"
, operator:
"startswith"
, value:
this
.value() }
);
}
else
{
$(
'#Grid'
).data(
'kendoGrid'
).dataSource.filter([])
}
}
</script>
I hope this helps.
Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sang
Top achievements
Rank 1
answered on 07 Aug 2012, 02:10 PM
Hi Petur,
Thanks for the information. If we generate our own header, it means that we can no longer use Kendo grid header to handle our sorting correct?
Thanks for the information. If we generate our own header, it means that we can no longer use Kendo grid header to handle our sorting correct?
0
Hello Sang,
Yes I intentionally disabled the sorting of the column because the other way the ComboBox is unable to open.
Regards,
Petur Subev
the Telerik team
Yes I intentionally disabled the sorting of the column because the other way the ComboBox is unable to open.
Regards,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Tito
Top achievements
Rank 1
answered on 28 Aug 2012, 03:48 PM
Hi Petur,
there is a small problem with this implementation, it doesn't consider the other filters, so if I select the productName filter it give me the filter only by the productName, disconsidering the other columns. I am trying to consider the other columns as well, do you have any idea?
Best Regards.
Tito Morais
there is a small problem with this implementation, it doesn't consider the other filters, so if I select the productName filter it give me the filter only by the productName, disconsidering the other columns. I am trying to consider the other columns as well, do you have any idea?
Best Regards.
Tito Morais