Results 1 to 3 of 3

Thread: [SOLVED] DataView, ListStore and filters... Question and Bug

  1. #1
    Ext User
    Join Date
    Sep 2008
    Vote Rating

    Question [SOLVED] DataView, ListStore and filters... Question and Bug

    Hi all,
    I have some code that binds a DataView to a ListStore. All works great until I try to use a filter to filter that ListStore. If I bind the ListStore to something else after the filter has been attached, then all is well, however nothing happens to the DataView when the filter is applied.

    One other thing I tried was to call the setStore method again after applying the filter. When doing this, there appears to be a bug where the list doesn't get cleared before the new store is applied. For example, if I have a set {a, b, c} and I filter the store to only a, then reapply it with setStore, the ListView will show {a, b, c, a}.

    NOTE: I realized that I should be using a DataViewBinder rather than setStore (what is setStore for then???) but I still can't get my list to update when the filter changes, even with the DataViewBinder.

    Any help with both of these issues would be greatly appreciated.

  2. #2
    Ext User
    Join Date
    Sep 2008
    Vote Rating


    So I tried using the same code but swapping out the DataView with a Table. Works fine when I do that. That means the problem is definately with the DataView, or the way I'm using it. Here is some code showing how I configure the DataView.

    Do I need to do something special with my template?

    // In the constructor of a Composite...
    DockPanel dockPanel = new DockPanel();
    final VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSize("100%", "0");
    dockPanel.add(verticalPanel, DockPanel.NORTH);
    dockPanel.setCellHeight(verticalPanel, "0%");
    _header = new Text();
    // Create the filter
    _txtSearchBox = new MyFilterField(); // Just a normal StoreFilterField...
    _txtSearchBox.setEmptyText("Search for item...");
    _dataView = new DataView(new Template("<div><h3>{name}</h3><div>{summary}</div></div>"));
    dockPanel.add(_dataView, DockPanel.CENTER);
    dockPanel.setCellHeight(_dataView, "100%");     
    // Bind the model to the view, the search box to the list.
    _listStore = getList(); // Gets a normal ListStore<MyModel> with a few items in it... 
    DataViewBinder<MyModel> binder = new DataViewBinder<MyModel>(_dataView, _listStore);

  3. #3
    Ext User
    Join Date
    Sep 2008
    Vote Rating

    Thumbs up

    Okay... figured it out but this is *very* unintuitive...

    I needed to set the itemSelector and then add a class name to my DIV in the template. I did this earlier and it didn't work. It appears that the selector needs to be fully qualified, for example:

    <div class="item"></div>

    // Works

    // Does not work

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts