Announcement

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

    ListGrid with createRecordComponent

    Good day admin
    I used createRecordComponent in list grid and put radio button into the component. Every time I compile the code, the list grid will remain normal but once I press to another tab and click back to the page that contain the list grid, the list grid will jump away and the radio button will disappear. To counter this, I add in a button that destroy the list grid and reconstruct it but the problem still remain.

    I tested the code with latest smartgwt library 6.1p EE 29-12-2017, and run the code with Google chrome Version 63.0.3239.84 (Official Build) (64-bit), Internet Explorer version 11 ( 11.1106.10586.0) , Mozilla Firefox 43.0.4, Opera 49.0.2725 the problem still remain the same. I found out that the problem might be with the dynamicForm but I wasn't sure about it. Below is my sample code

    fruitListGrid = new ListGrid(){

    protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {

    String fieldName = this.getFieldName(colNum);
    DynamicForm form = new DynamicForm();
    final Integer rowNum = this.getRecordIndex(record);

    if (fieldName.equalsIgnoreCase("custom")) {
    scoreColNum = colNum;

    radioGroup = new RadioGroupItem("post_score_radio","");
    //radioGroup.setID("post_score_radio_id");
    radioGroup.setShowTitle(false);
    radioGroup.setWidth(10);

    LinkedHashMap<String, String> valueMap1 = new LinkedHashMap<String, String>();
    valueMap1.put("1", "1");

    LinkedHashMap<String, String> valueMap2 = new LinkedHashMap<String, String>();
    valueMap2.put("1", "0");

    int size = radioGroups.length;
    radioGroups [size] = radioGroup;

    if(rowNum % 2==0) {
    radioGroup.setValueMap(valueMap1); //
    } else {
    radioGroup.setValueMap(valueMap2);//
    }


    radioGroup.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler(){

    @Override
    public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
    if (rowNum % 2==0) {
    radioGroups [rowNum + 1].setValue(false);
    } else {
    radioGroups [rowNum - 1].setValue(false);
    }


    //getScoreTotal ();
    }
    });

    radioGroup.addChangedHandler(new com.smartgwt.client.widgets.form.fields.events.ChangedHandler () {

    @Override
    public void onChanged(com.smartgwt.client.widgets.form.fields.events.ChangedEvent event) {

    }
    });


    form.setFields(radioGroup);
    return form;
    }

    return form;
    }


    };
    // WidgetFormatter.applyDefaultListGrid(fruitListGrid);
    fruitListGrid.setFixedRecordHeights(false);
    fruitListGrid.setShowRecordComponents(true);
    fruitListGrid.setShowRecordComponentsByCell(true);
    fruitListGrid.setGridComponents(new Object[] {
    ListGridComponent.HEADER,
    ListGridComponent.BODY,
    });
    fruitListGrid.setShowRowNumbers(false);
    fruitListGrid.setAllowRowSpanning(true);
    fruitListGrid.setData(FruitRecord.getRecords());
    fruitListGrid.fetchData();

    fruitListGrid.setUseRowSpanStyling(false);
    fruitListGrid.setCanEdit(false);
    fruitListGrid.setHoverMoveWithMouse(false);

    ListGridField fruitParameter = new ListGridField("fruit","Parameter");
    fruitParameter.setWidth("20%");

    ListGridField fruitColor = new ListGridField("colors","Sign");
    fruitColor.setWidth("70%");

    ListGridField customCB = new ListGridField("custom","");
    customCB.setShowTitle(false);
    customCB.setCanEdit(true);


    fruitListGrid.setFields(fruitParameter , fruitColor , customCB);

    this.addMembers(fruitListGrid);

    #2
    It looks like you are enabling row spanning features but not using this system. rowSpanning and record components can't be used together. Turn this off and retest.

    Comment


      #3
      I turn off the setRowSpanning but the list grid still acting abnormal once I go into the page. 1.PNG is the normal list grid
      Click image for larger version

Name:	1.PNG
Views:	271
Size:	4.5 KB
ID:	251005

      while 2.PNG is the abnormal list grid, the abnormal list grid is actually jumping but I cant capture the motion in image file.
      Click image for larger version

Name:	2.png
Views:	277
Size:	3.9 KB
ID:	251004

      Comment


        #4
        We were not able to reproduce the issue with your sample code. We suggest that you test with only built-in skins and no external CSS, and if the problem remains, please post a complete test case.

        Regards
        Isomorphic Software

        Comment

        Working...
        X