Filters for DataView?

Page 1 of 2 12 LastLast
  1. #1

    Filters for DataView?

    Is there anything similar to a GridFilter for a DataView? I have a DataView that has a custom template (really using it as a ext:Store driven repeater so that the items render as <li> elements). The great thing about this is that the PagingToolbar works on the Store, giving me paging in the DataView, but I also really need filtering.

    GridFilter has all of the functionality that I need, and I assume it works on the ext:Store also, but it seems to only work inside the <Plugins> element of the GridPanel.

    ... any ideas that will give me filtering - short of writing it on my own?
  2. #2

    RE: Filters for DataView?

    The GridPanel Filter plugin might be easily adapted.

    Out of interests sake, how to see applying the filters? What would the interface look like?


    Geoffrey McGill
    Founder
  3. #3

    RE: Filters for DataView?



    I was just looking at how easy it would be to adapt that plugin, since I noticed that if I added a GridPanel with the filter plugin on the same store (on the same page) as my DataView that when I apply filters to the GridPanel, they also automatically apply to the DataView.

    It would be great if the filters were done as a menu (same as the GridPanel), such that I could add the filter menu inside a regular or split button on my own toolbar, a PagingToolbar, or some other random place on the page...

    I also noticed that I can call .filter() on my store (on the client) to produce similar results... so, I might just make a simple menu for now (until something is added to coolite) that has Handlers that call filter() as I need.
  4. #4

    RE: Filters for DataView?

    Ext.data.Store.filter() and .clearFilter() don't work as well as I had wanted... I'll play with it more, but hopefully the next version of coolite will have a better solution.
  5. #5

    RE: Filters for DataView?

    Hi,

    GridFilters plugin is using store.filter() function to filter grid. So, you don't need another filter tool. The great example which shows how to use store.filter is
    https://examples1.ext.net/#/GridPanel/MultiHeader/Filter/
    Vladimir Shcheglov
    Sr. Developer
  6. #6

    RE: Filters for DataView?

    Thanks Vladimir!
  7. #7

    RE: Filters for DataView?

    Vladimir - Thanks for the pointer to the MultiHeader sample, I was able to get what I needed... although, I still have one issue.

    My Store has both a PagingToolbar and now filters (using nearly identical code to the MultiHeader sample), when I apply a filter it seems to only filter the current page worth of items... for example, I am currently on page 1 of 3 viewing 50 of 150 records. I apply a filter that reduces the record set to 30 - so they should all fit on the page, but of those 30 only 15 were on the first page. The result is that the DataView only shows 15 records... how do I get it to show all 30 and update the PagingToolbar to say "Displaying 1 - 30 of 30"?

    Just in case the above only made sense to me: How do I get the filter to update both the store and the pager?

    My store is a JsonReader, and all records are bound in the page's OnInit() - so the store's entire dataset is delivered with the page html.
  8. #8

    RE: Filters for DataView?

    Hrrmm... the filters at:
    https://examples1.ext.net/#/GridPane...dFilters_Local

    Seem to adjust the paging... I'll go through the GridFilters code to see what I am missing.
  9. #9

    RE: Filters for DataView?

    Ok, I give up... changing the page on the PagingToolbar seems to clear the store's filter. I must be missing something, but I can't seem to find it.

    Any ideas?
  10. #10

    RE: Filters for DataView?

    (in addition to the JS in the MultiHeader example)

    If I add this to my store:
        <Listeners>
            <Load Handler="#{Store1}.filterBy(getRecordFilter());" />
        </Listeners>
    And this to my filter text field:
        <Listeners>
            <KeyUp Handler="#{Store1}.load();" Buffer="250" />
        </Listeners>
    Then the DataView updates to show all 50 items that match the filter (regardless of page), but the PagingToolbar updates from "displaying 1 - 48 of 150" to "displaying 1 - 50 of 150", but the page count still remains at 3... I would have expected this to change to "displaying 1-48 of 50" and the page count to change to 2.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] CalendarPanel filters
    By marco.morreale in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 05, 2012, 2:32 PM
  2. [CLOSED] DataView to DataView Drag and Drop
    By paulc in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 10, 2012, 9:19 PM
  3. [Razor] Example for grid filters
    By Natalie in forum 2.x Help
    Replies: 4
    Last Post: Apr 23, 2012, 10:22 AM
  4. Replies: 3
    Last Post: Jan 12, 2012, 4:26 PM
  5. Grid filters in code-behind
    By petlun in forum 1.x Help
    Replies: 4
    Last Post: Jan 01, 2009, 3:40 PM

Posting Permissions