Announcement

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

    Get the criteria for a listgridfield

    I am using smartgwt power 2.5 nightly and running gwt 2.3. I am trying to individually get the criteria for a listgridfield, is this possible? The listgrid has several columns and some of the fields have option datasources for their value maps. I tried getting the value selected using the select item, but that didn't work since I used setFilterEditorProperties. Would I have to add a clickhandler to the selectitem to get the values selected? I didn't know if this was the only way to get the values selected on demand.

    #2
    We don't entirely follow your requirement here, but it sounds like you want to look at the selected value of a filter-editor field when the user updates it, before the filter occurs on the grid.
    Is that right?

    If so you could use listGridField.filterEditorProperties to apply a 'changed' handler to the automatically generated form item that shows up in the filterEditor for the field.

    Comment


      #3
      Originally posted by Isomorphic
      We don't entirely follow your requirement here, but it sounds like you want to look at the selected value of a filter-editor field when the user updates it, before the filter occurs on the grid.
      Is that right?

      If so you could use listGridField.filterEditorProperties to apply a 'changed' handler to the automatically generated form item that shows up in the filterEditor for the field.
      It doesn't necessarily have to be when a user updates it. I'm going to have a button on a toolstrip that the user can press to perform some actions, and its at that moment that I want to look at all the fields in the listgrid and see what has been selected from the select items and what has been typed in the text items. I understand I could get the advanced criteria from the listgrid but I'm trying to stay away from that if possible. Let me know if my explanation wasn't sufficient.

      Comment


        #4
        Sure that makes sense.

        If you wanted to get the actual criteria entered by the user, you could use getFilterEditorCriteria().

        However we understand that's not exactly what you're looking for.
        We don't currently have a supported API to reach into the filterEditor and retrieve per-field values from the editor. We'll look into adding such an API.
        However - you can achieve this for now via the following:
        Code:
        myListGrid.filterEditor.getEditValue(0, <fieldName>);
        Explanation: The listGrid "filterEditor" is the auto-generated component that the user actually enters filter criteria into when showFilterEditor is true. This is implemented as a special subclass of ListGrid, and is editable, so the "getEditValue()" is checking for the edit value of the first row in this grid (the only row that it actually contains).

        As noted - this is not an officially supported API so we can't guarantee that it will not change in a future release. However it is very unlikely that this particular area will be changed in a way that would break this method call.
        We've noted that this has been exposed in this forum thread and will be sure to update it if we ever make a change that would obsolete this approach (or when we add a supported equivalent).

        Comment

        Working...
        X