Announcement

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

    problem with setEditorProperties for selectItem in Form, then after saving to listgrid then after upgraded to smartgwt 12.0

    Hi Isomorphic


    I am getting problem with setEditorProperties using for selectItemItem on form and saving to listgrid after upgraded to smartgwt 12.0. Previously we used used setEditortype for selectItem on dynamic form. But now it is deprecated I am using setEditorProperties for selectItem to set fields into list grid.

    I have list grid and some conrols on form. When I click on Add Criteria, it will open one dynamic form having 3 dropdowns. If we select one dropdow, depends on the value selected in first dropdown second dropdown will open. User has to select value from second dropdown. Next based on these dropdown selects another dropdown display values. User has to select value from third dropdown and click save. It will go and save into listGrid. This is work fine. when user select one row on listgrid it should open form it should display 3 dropdowns. First 2 dropdowns should be disabled 3dropdown should be enable. This is working fine until smartgwt 6.0. But after upgraded to smartgwt 12.0 I used setEditorProperties instead of setEditorType for third dropdown. So when I select row on the grid I couldn't see third dropdown in enable position.

    This is the code I used for creating dropdown

    filterValueSelectItem = new SelectItem();
    filterValueSelectItem.setAutoFetchData(false);
    filterValueSelectItem.setOptionDataSource(DonationDataSourceFactory.getInstance(DonationDataSource.AllocationTypeDS));
    filterValueSelectItem.setValueField(TypeDataSourceBase.KEY);
    filterValueSelectItem.setDisplayField(TypeDataSourceBase.VALUE);
    filterValueSelectItem.setValueMap(emptyMap);



    private void createFilterValueField(final DataSource ds) {
    filterValueField = DonationFormItemFactory.getFormItem(ds, DonTotalFilterDS.FILTERVALUE);
    filterValueField.setValueField(TypeDataSourceBase.KEY);
    filterValueField.setDisplayField(TypeDataSourceBase.VALUE);
    filterValueField.setWidth(FIELD_WIDTH);
    filterValueField.setRequired(true);

    filterValueField.setEditorType(filterValueSelectItem);

    filterValueField.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(final ClickEvent event) {
    setFilterTypeCriteria(filterTypeCode);
    }
    });

    filterValueField.addChangedHandler(new ChangedHandler() {
    @Override
    public void onChanged(ChangedEvent event) {
    if(!(event.getValue() instanceof Integer)){
    inOperatorList = (String[])event.getValue();
    filterValueList = inOperatorList;
    }
    }
    });
    }

    To get values from third dropdown for value map I am using below code

    protected void setfilterValueMultipleField(SelectItem selectItemType) {
    filterValueField.setAttribute("value", filterValueList);
    selectItemType.setValues(filterValueList);
    //filterValueField.setEditorType(selectItemType);
    //filterValueField.setEditorType(selectItemType);
    filterValueField.setEditorProperties(selectItemType);
    }

    protected void setfilterValueField(SelectItem selectItemType) {
    // if changed from multiple to non-multiple, clear out filterValueString if it contains a comma
    if (filterValueString != null && filterValueString.contains(",")) {
    filterValueField.clearValue();
    filterValueList = null;
    } else {
    selectItemType.setValue(filterValueString);
    }
    //filterValueField.setEditorType(selectItemType);
    filterValueField.setEditorProperties(selectItemType);



    }



    This is the code I am using in listgrid for third dropdown

    ListGridField filterValueField = new ListGridField("filterValue");
    filterValueField.setTitle(BaseConstants.guiConstants.criteriaTitle());
    filterValueField.setWidth("30%");
    filterValueField.setAlign(Alignment.LEFT);
    filterValueField.setCanEdit(false);
    filterValueField.setDisplayField("filterDescription");
    filterValueField.setValueField("filterValue");

    ListGridField filterDescriptionField = new ListGridField("filterDescription");
    filterDescriptionField.setHidden(true);

    totalFilterGrid.addRecordClickHandler(new RecordClickHandler() {
    @Override
    public void onRecordClick(final RecordClickEvent event) {
    if (!event.getField().getName().equals("remove")) {
    Record record = event.getRecord();
    editFilterRecord(donTotalTypeForm, record, false);
    }
    }
    });

    totalFilterGrid.setFields(donTotalFilterType, donTotalOperationType, filterValueField, removeField, donTotalInstructionType,
    donTotalColumnType, filterDescriptionField);
    //totalFilterGrid.fetchData();


    return totalFilterGrid;
    }

    private void editFilterRecord(final DynamicForm donTotalTypeForm, final Record record, final Boolean isAddRecord) {
    new DonTotalFilterPopup(DonTotalTypePopup.this, donTotalTypeForm, record,
    donTotalOperationTypeCodeMap, isAddRecord);
    }


    I have boolean, it is true we can add new criteria and if it is false when click on list grid record the same form should show 3 popups. 3rd popup should be enable. This is not enabling after upgraded 12.0 and used setEditorPropeties for third popup. The same code is working fine with smartgwt 6.0 even with setEditorPropeties


    The code is working fine until 6.0 version, after upgraded to 12.0, this is not working.

    please help me on this.

    Thank you
    Rama






    #2
    It looks like you're trying to call setEditorProperties() on a ListGrid field after the ListGrid has been created and drawn. This was always an invalid approach; fields cannot be changed directly after setFields() (see docs). Warnings in your Developer Console are telling you this is not a supportable way of doing things.

    It looks like you're just doing it to try to update a valueMap. listGrid.setEditorValueMap() is one of several valid ways to achieve this. See also listGrid.setFieldProperties() for dynamically updating other properties you may need.

    Comment


      #3
      Hi Isomorphic,

      Thank you for your suggestions. Can you please tell me in the above code where do I need to take setEditorPropeties and where do I need to add setEditorValueMap()

      The scenario is like this. When I click the button one form will open. There is one dropdown on that. When I select value from dropdown, another dropdown will open. Finally third drop will open base above to selections. User three dropdown I will select values then save to Listgrid. After I saved to listgrid, if click on record in listgrid again it will open form with three dropdowns. The first two dropdowns should be disable and third dropdown should be enable with select value and user should able to select another any value from third dropdown if he wants to change and then save. The listgrid row should be updated with new value from third dropdown.

      In my code I am taking value from filterValueField (this is selectItem) and saving to list field with name. I tried couple of ways it is always displaying default datasouce values. It is not updating with new value depends on first and two dropdown when user trying to edit the record after saved to listgri.

      Please help me on this

      Thank you
      Rama

      Comment


        #4
        Where you are currently trying to call setEditorProperties() on a field (which is invalid), call setEditorValueMap() on the grid instead, if all you want to update is the valueMap used during editing. There is also listGridField.setValueMap() if you are trying to update the valueMap for *both* display and editing.

        If you need to update other properties, call grid.setFieldProperties().

        Comment


          #5
          Hi Isomorphic

          Thank you for reply. I didn't find any method like setEditorValueMap() to call grid. I could see only setEditorValueFormatter and setEditorValueParser and setCriteriaField. I am using smartgwt 12.0. So which method is best to use in my case. I am using setValueMap to listGridField. Please help me on this.


          Thank you

          Comment


            #6
            Hi Rama1,

            the method is here.

            Best regards
            Blama

            Comment


              #7
              Thank you Blama

              Comment

              Working...
              X