Announcement

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

    ListGridField with SelectOtherItem EditorType

    I have an editable ListGrid which has a field with an EditorType of SelectItem set. I have defined the PicklListFilterCriteria for the SelectItem and every thing is working well. Now the customer wants to have the choice of doing a text enter on the field or using the current dropdown selection. I changed the SelectItem to a SelectOtherItem and set the OtherTitle and OtherValue fields. It continued to behave as it did with the SelectItem (providing a pulldown menu without the "Other" option). Should this work? Is there some other method I can use to get the results I need?

    We're using SmartGWT 2.0, SmartClient_70rc2 Evaluation, Firefox 3.0

    #2
    SelectOtherItem is really a SelectItem with two additional entries (the seperator and Other) but otherwise performs the same. So when you filter the value map will get replaced, so I would expect you loose those two entries. But those other values are still checked for, so if you add them back it will function properly. Best option would be try to add a data arrived handler for it and append those two items via getSeparatorTitle() and getOtherTitle()

    Comment


      #3
      Thanks svjard for your input. Sadly I can't get it to work that way. When the event handler fires is in association with the PickListFilter executing and the only values available within the handler are fields indicating event row and type information. Every attempt to access the data ends up in a nasty stack that starts out complaining that the function I'm attempting to use is not defined. I have found references to this problem in other posts. There are also several suggestions to handle it with a fetchData execution so the other fields can then be added. I would like to avoid this because of the interrelationships I have set up using the PickListFilterCriteriaFunctions.... I would like to think that the SelectOtherItem would always provide the "Other" options no matter how the select values are populated but it doesn't seem to be setup that way.

      Comment


        #4
        Ok,
        I've finally broken down and implemented this by creating the value maps I want displayed locally.
        I can dynamically create the value map for the SelectOtherItem used by the ListGridField. However, I am having an issue getting it to redraw properly.

        this is the sequence:
        ListGridField id ;
        SelectOtherItem idEditor ;


        String[] str = String[3]{"1","2","3"} ;

        idEditor.setValueMap(str) ;
        id.setEditorType(idEditor) ;

        ....
        .... // first execution of onChanged
        ... onChanged() {
        String[] str2 = String[4]{"one","two","three","four"} ;
        idEditor.setValueMap(str2) ;
        id.setEditorType(idEditor) ;


        .... // second execution of onChanged
        String[] str2 = String[4]{"six","seven","eight","nine"} ;
        idEditor.setValueMap(str2) ;
        id.setEditorType(idEditor) ;

        selection box value that are displayed:
        initial display : 1,2,3
        after first onChanged : 1,2,3
        after second onChanged : one, two, three, four
        after third onChanged : six, seven, eight, nine

        I have tried .redraw/.draw on the SelectOtherItem and on the ListGrid. I've also tried creating a new SelectOtherItem instead of just updating the old one with the same results.

        I would really appreciate any help.


        UpDate: If I execute a MyGrid.setFields(id,....) ; at the end of the changed handler I get the desired results. Is this the right way to fix this?



        (I hope this example is good enough, I can't cut and paste from my development system to this forum)
        Last edited by pparas; 15 Jul 2010, 09:42.

        Comment

        Working...
        X