1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    30
    Vote Rating
    0
    Greeens is on a distinguished road

      0  

    Default Having Problem with Filtering the Grid

    Having Problem with Filtering the Grid


    Hi Everyone,

    I've spend the whole day tried to figure this out. Would anyone please give me some hints.

    The following function get the value from a html textbox and will filter the grid. (The grid already has data.xml load into it in the init method).

    function filter_value()
    {
    var para = window.document.getElementById("field1").value;
    GridPanel1.getDataModel().filter({2: para});;
    }

    It works perfectly for the first time filtering. However, since the filter function actually remove the record in the dataModel, user would not be able to do a filter with the original data.xml file when they do a search the second time (because the dataModel is already filtered). Therefore I add the following line attempting to reload the xml file into the dataModel before the filtering. The method becomes:

    function filter_value()
    {
    GridPanel1.getDataModel().load("data.xml");
    var para = window.document.getElementById("field1").value;
    GridPanel1.getDataModel().filter({2: para});;
    }

    The problem appears. The filtering would not work now. I see the grid to have the filter ed record for 2 seconds. Then it load every records in data.xml file into the grid again, even if I place the load("data.xml") statement before the filter statement.

    I hope you guys understand what I mean.
    Please help if you know why this is happening and anyone please kindaly post a solution.

    Thousands Thanks!!!

  2. #2
    Sencha Developer
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    482
    Vote Rating
    1
    Wolfgang is on a distinguished road

      0  

    Default


    Have you considered to do the filtering on the serverside, given that the data is generated on the server?

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    30
    Vote Rating
    0
    Greeens is on a distinguished road

      0  

    Default


    Sorry I'm kinda a newbie.

    How do I do the filtering in the server side? Can you suggest an example how could I do this?

  4. #4
    Sencha Developer
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    482
    Vote Rating
    1
    Wolfgang is on a distinguished road

      0  

    Default


    Quote Originally Posted by Greeens
    Sorry I'm kinda a newbie.

    How do I do the filtering in the server side? Can you suggest an example how could I do this?
    I am not sure i understand your question.
    You somehow generate data on the sever, don't you?
    Now you need to add some additional params to you your http request created by the grid that you pass to your backend script.

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    30
    Vote Rating
    0
    Greeens is on a distinguished road

      0  

    Default


    My data is just a xml file.
    I just Dm.load("data.xml"); to load the xml file in the grid, and I want to do filtering with the grid with the parameters entered by the user in the textbox.
    How should i do this?

  6. #6
    Sencha Developer
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    482
    Vote Rating
    1
    Wolfgang is on a distinguished road

      0  

    Default


    There are 2 options:
    - Do filtering on the client side (that is what you do now)
    - Do filtering on the server side.

    If you do filtering on the server side, then the data.xml file you provide, must be the filtered one.
    So if you use a static data.xml file this is not possible, until you write server side code, that uses your data.xml file as input and provides the filtered data as output.
    Then you do not return data.xml but filtered-data.xml.

Similar Threads

  1. Grid Filtering and Reloading
    By Greeens in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 15 Feb 2007, 10:33 PM
  2. grid filtering, toolbar render problem on focus of input
    By seldon in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 10 Feb 2007, 3:00 AM
  3. Filtering a grid
    By gfraser in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 29 Jan 2007, 2:58 PM
  4. Grid Filtering / Search
    By prophet in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 17 Jan 2007, 1:01 PM
  5. Filtering grid on the fly
    By techno_adi in forum Ext 1.x: Help & Discussion
    Replies: 12
    Last Post: 13 Oct 2006, 3:13 AM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar