Announcement

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

    SelectItem is disabled in SmartGWT 3.0

    1. SmartGWtPower 3.0

    2. I am using SelectItem for one of the dynamicform and listgrid (attached to the listgridfield). Both of them are disabled and i could not able to select any value from the SelectItem.

    Initially it used to work in 2.4. The only changes is i added the datasource to the form, along with the valuesmanager.

    i was forced to do this becuase i am getting the runtime exception if did not attach datasource to that form.

    #2
    Able to solve the SeletItem in form by setting the form.setvaluesManager (vm) and removing the setdatasource directly to the form. But still I am not able to resolve the SelecItem getting disabled in the ListGrid.

    Comment


      #3
      Sorry, that's way to little information for anyone to help, but as a stab in the dark, you might be able to set canEdit:true on the field to force editing if you had turned it off in some other way.

      Comment


        #4
        ListGrid languageMgmtGrid = getGrid();
        languageMgmtGrid.setWidth100();
        DataSource attrLanguageDS = DataSource
        .get(ManagementUtil.ATTRIBUTE_LANG_DS_FILE);
        DataSource languageDS = DataSource.get(ManagementUtil.LANG_DS_FILE);
        languageMgmtGrid.redraw();
        languageMgmtGrid.setDataSource(attrLanguageDS);
        ListGridField langFields[] = languageMgmtGrid.getFields();
        languageMgmtGrid.setAutoSaveEdits(false);

        for (int i = 0; i < langFields.length; i++) {

        if (langFields[i].getName().equals(ManagementUtil.LANG_NAME)) {
        SelectItem languageItem = new SelectItem();
        languageItem.setOptionDataSource(languageDS);

        ComboBoxItem languageCBItem = new ComboBoxItem();
        languageCBItem.setOptionDataSource(languageDS);

        langFields[i].setEditorType(languageItem);
        langFields[i].setFilterEditorType(languageCBItem);

        }

        }
        languageMgmtGrid.setFields(langFields);
        return languageMgmtGrid;


        The DS is as follows:

        <fields>
        <!-- attribute id matches attrlang id of attribute table -->
        <field name="ATTR_LANG_ID" primaryKey="true" title="Attribute Language ID" length="3" hidden="true"></field>
        <field name="ATTR_VALUE_ID" primaryKey="true" title="Attribute Value ID" length="3" hidden="true"></field>
        <!-- foreign key relation to language table-->
        <field name="LANG_KEY" title="Language Symbol" length="20" type="text" hidden = "true" customSQL="true" tableName="T_LANGUAGE_MASTER"></field>
        <field name="LANG_NAME" title="Language Name" length="20" type="text" hidden = "false" customSQL="true" tableName="T_LANGUAGE_MASTER"></field>

        <field name="ATTR_LANG_FORM_NAME" title="Form Label Name" length="60" type="text" hidden="false"></field>
        <field name="ATTR_LANG_GRID_NAME" title="Grid Field Name" length="45" type="text" hidden="false"></field>
        <field name="ATTR_LANG_DESC" title="Field Description" length="2000" type="text" hidden="false"></field>
        <field name="ATTR_LANG_EX_CNT" title="Example Content" length="500" type="text" hidden="false"></field>

        </fields>

        I need to show a SelectItem(Dropdown) for the LANG_NAME with list of languages. the same code was workign in 2.4 where i can double click the record in the grid and edit the language or add new record with different language. in 3.0, the language is disbaled. i can only edit or enter data in other fields except language Name

        Comment


          #5
          Right, since you've set tableName that DataSource is assuming you can't edit this field. If you have custom logic that enables changes to be saved to this field, set canEdit="true" on the DataSource field to explicitly indicate this.

          Comment


            #6
            how come it is working in 2.4 and not working in 3.0

            Comment


              #7
              Because we added more automatic behavior here, defaulting the field to be disabled since the DataSource would just have an error if there was an attempt to save. You've evidently added custom logic that allows the save, so you should add canEdit="true" to any fields where saving will actually work.

              Comment


                #8
                Give your selectItem's width with manually for example slcItem.setWidth(150)

                Comment

                Working...
                X