Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Filter on optionDataSource displayed value

    I apologise if this seems basic, but this has been eluding me for a few hours of trying different approaches.

    I have a datasource which contains an ID field, lets call it FieldA. This is shown in a grid, where I use an optionDataSource to map ID -> Name.

    I want the FilterEditor to show above, as it does in other tables, and allow the user to filter on the values that are shown in FieldA - that is to say, the Name values. I don't want to filter on ID - the ID values are hidden to the user.

    Issue 1) The default FilterEditor behaviour is to show a SelectItem. I can fix this by manually setting the filterEditor to a TextItem. But...

    Issue 2) It does not filter on the Name - it's actually doing the filter by the ID value. Of course this makes sense to me and you as programmers, but the user sees the Name and wants to filter substring matches on Name.

    How do I implement this correctly?

    I realize I could make the field show Name instead of ID -> Name, but that screws up the optionDataSource select item in the grid - which works fine.

    #2
    Also, a simple, "not currently possible" would also be greatly appreciated.

    Comment


      #3
      So, I tried creating a String field on which to filter. This works as expected, giving the correct filter editor behaviour.

      I then tried to add an optiondatasource to the field, to allow the listgrid to correctly allow a select or combo when editing the listgrid. Unfortunately, doing this screws up the filter editor. I also tried setting the filter editor to a TextItem but it seems the filter is changed in some way because it no longer filters on substring.

      My next attempt will be to explicitly set the ListGrid field editor to a select/combo item and specify the option datasource on the field editor instead of on the listgridfield.

      Comment


        #4
        *bump*

        Does anyone have a better suggestion on how to implement this?

        Did I miss some part of the documentation or showcase where this kind of feature is implemented. It seems like it would be a very a common use case.

        Comment


          #5
          So it seems this feature is only possible with the Power/Enterprise version.

          http://www.smartclient.com/smartgwte...e_valuemap_sql

          And even that will only work with the SQL datasource.

          I will likely implement this using a DMI method.

          Comment


            #6
            We haven't looked closely at what you want, but your statement as to which editions are required or which storage engines would support it is definitely wrong. Please try to avoid this in the future.

            Comment

            Working...
            X