Announcement

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

    different setEditorType for every row in listGrid

    Hello,

    I have a listGrid with 2 columns. Based on the value of first column, editor type of the second column should change.

    How can I implement this usecase?

    I tried to use setEditorType(), but the editor type is checked once per listgrid, and not per row. I saw this thread: http://forums.smartclient.com/showthread.php?t=10267, but couldn't understand how createRecordComponent helps.


    Any tip is appreciated.

    thanks

    #2
    FYI
    I found a way to change an editorType on recordClick:
    Code:
             final ListGridField valueField = new ListGridField("value", "Custom value");
             valueField.addRecordClickHandler(new RecordClickHandler() {
                @Override
                public void onRecordClick(RecordClickEvent event) {
                    if(event.getRecordNum()<3){
                        valueField.setEditorType(new SpinnerItem());
                    }else{
                        valueField.setEditorType(new CheckboxItem());
                    }
                }
            });
    There is a bug in this code, RecordClickEvent isnt published when user navigates using a keyboard (described in another thread: http://forums.smartclient.com/showthread.php?t=13344)
    Last edited by la123; 20 Sep 2010, 07:24.

    Comment


      #3
      I found ListGrid.getEditorType(field, values) function in smartClient. It looks exactly as the function I need for the above case.

      Is it possible to add it to smartGWT APIs?

      ListGrid: getEditorType (field, values)
      Default implementation will return field.editorType if specified. If not specified, the default form item for the appropriate data type will be displayed - can be overriden to provide a different specific form item type for some field based on the record/field data.
      http://www.smartclient.com/docs/6.5....group..editing

      thank you

      Comment

      Working...
      X