This is a migrated thread and some comments may be shown as answers.

refill the grid,based on inputs

6 Answers 15 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 07 Aug 2013, 12:38 PM
Hello,
i have another question:
I would like to filter the grid data,based on some filters(textboxes or dropdowns) and when i press a button,the date will be loaded into the kendo grid.But initially i do not want to fill anything.based on filter inputs,i create the criteria and make the selection in where clause of the repository for the given entity.
How can i do that?can you show me an example?
Best Regards,
Daniel

6 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 09 Aug 2013, 07:02 AM
Hi Daniel,

You can apply filter to the Grid's DataSource via its filter method. This online demo demonstrate such usage.

If you do not want the grid to be populated initially you should set the AutoBind option to false.

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 12 Aug 2013, 10:40 AM
Yes,but i do not want when i change a dropdown,only when i press a button,and depending on what i have filled in textboxes and dropdownlists,
i refill the grid with the filtered data.in this case is the same changeEvent? also i do not see some refresh in that example,is enough to set the filter and will refill the source with the right data?
0
Nikolay Rusev
Telerik team
answered on 14 Aug 2013, 06:25 AM
Hello Daniel,

If you don't want to filter the Grid right away on change of the DropDown you should execute the code from the its change handler inside click handler of the button.

Once the filtering operation (issued by filter method) is finished it will trigger DataSource change event which will refresh the Grid.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniel
Top achievements
Rank 1
answered on 14 Aug 2013, 06:54 AM
ok,thank you for the information,i will try it out.

Regards,
Daniel
0
Daniel
Top achievements
Rank 1
answered on 14 Aug 2013, 12:42 PM
Ok,i put the the content of the change event,to the click function of my button,and in that function who will be this.value? because i get an error with this message:
this.value is not a function
in my case,the id of each field is EntityField_GuidNumber is difficult to take each field separately and filter based on that,instead i put all the inputs in a <form></form> somehow i should get all the values from that form,and create a filter expression,that later is applied to the source of the grid.
so what is the solution to this problem?
maybe a small example with a form that has some inputs,and the grid will be filtered after pressing a button,based on what values are in the inputs,will be more than satisfying.
Regards,
Daniel
0
Nikolay Rusev
Telerik team
answered on 16 Aug 2013, 07:51 AM
Hello Daniel,

The error "his.value is not a function" is because `this` in the context of the button click handler is not the Kendo DropDown widget. Instead you must get reference to the DropDown widget use its value API method.

"in my case,the id of each field is EntityField_GuidNumber is difficult to take each field separately and filter based on that,instead i put all the inputs in a <form></form> somehow i should get all the values from that form,and create a filter expression,that later is applied to the source of the grid.
so what is the solution to this problem?
"

 - The values from the fields can be extracted with DOM operations. You can use the help of jQuery serializeArray.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Daniel
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or