Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

client-side filtering in GridControl

Help
Raymond Li
2011-06-15
2012-12-13
  • Raymond Li
    Raymond Li
    2011-06-15

    Dear all,
    Does any one know how can I do client-side filtering with GridControl?

    I could already do server-side filtering by using  something like

    FilterWhereClause f = new FilterWhereClause("name",Consts.LIKE,list);
          grid.getQuickFilterValues().put("subjectname", new FilterWhereClause{f,null});

    Indeed, I want to let the user to search for keyword in multiple columns.

    Thanks in advance!

    Raymond

     
  • Raymond Li
    Raymond Li
    2011-06-16

    Hi,

    I have studied JTable's filter mechanism in these two days.

    It seems that we can make use of setRowSorter() in class TableRowSorter. And we can call setRowSorter() from Grid (which inherited from JTable), so that we can make use of RowFilter.

    Therefore, we can add a client-side filtering logic to Grid by exposing a function to set a RowFilter.

    Does anyone has opinions?

    Yours,
    Raymond

     
  • Raymond Li
    Raymond Li
    2011-06-16

                            Failed to implement Client-side filtering with TableRowSorter and setRowFilter().

    Hello,
    I just tried to add a sorter to member variable "grid" in Grids. Like the following

      private TableRowSorter<VOListTableModel> sorter;

    And then I call setRowFilter() to the sorter. But I failed. The screen will not refresh. And when I scroll it, it will not repaint correctly.

    I think I have not understood the painting logic of GridControl.

    I will study more. But I would be grateful if anyone give me some hints or sharing.

    Raymond

     
  • Raymond Li
    Raymond Li
    2011-06-20

    Hi,
    I have make a amended GridControl to implement setRowFilter(). When the amendment, I can use RowFilter to carry out client-side filtering.

    In additional, we can use DocumentListener to update the RowFilter. Subsequently, a very smooth searching effect could be achieved.

    I would share some codes soon.

    Raymond

     
  • mcarniel
    mcarniel
    2011-09-24

    Why not simply use the quick filter feature available for every column?
    Anyway, you can always pass to the server side any other conditions using gridcontrol.getOtherGridParams() and programatically manage them on the server side…