refill the grid,based on inputs

7 posts, 0 answers
  1. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 07 Aug 2013 Link to this post

    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
  2. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 09 Aug 2013 Link to this post

    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!
  3. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 12 Aug 2013 Link to this post

    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?
  4. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 14 Aug 2013 Link to this post

    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!
  5. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 14 Aug 2013 Link to this post

    ok,thank you for the information,i will try it out.

    Regards,
    Daniel
  6. Daniel
    Daniel avatar
    192 posts
    Member since:
    Mar 2012

    Posted 14 Aug 2013 Link to this post

    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
  7. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 16 Aug 2013 Link to this post

    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!
Back to Top