Announcement

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

    ListGrid - createRecordComponent Issue

    Hi,

    I am trying to display checkboxes in 2 columns in a ListGrid and for some rows, disabling checkbox access depending on data. I am achieving this overriding createRecordComponent method.

    Issue - We have page navigation, When we are navigating back & forth, i am hiding & showing ListGrid, every time i hide and show - this is triggering createRecordComponent to execute each time ListGrid shows, due to this we are getting performance issue, can we just execute once "createRecordComponent" while creating ListGrid after that it don't call this method while hide/showing ListGrid, can you please let me know how to avoid mulitple calls to createRecordComponent method while hide and showing ListGrid.


    Code :


    ListGrid technicianListGrid = new ListGrid()
    {
    @Override
    protected Canvas createRecordComponent(final ListGridRecord record,Integer colNum)
    {
    final String fieldName = this.getFieldName(colNum);
    DynamicForm d = null;
    if(fieldName.equals("Repair") || fieldName.equals("MAC"))
    {
    d = new DynamicForm();
    String value = record.getAttribute(fieldName);

    if(value == null || value.equalsIgnoreCase("") || value.equalsIgnoreCase("Disable"))
    {
    CheckboxItem cb = new CheckboxItem();
    cb.setName(fieldName);
    cb.setShowTitle(false);
    cb.setShowLabel(false);
    if(!value.equalsIgnoreCase("Disable"))
    {
    cb.addChangedHandler(new ChangedHandler()
    {
    @Override
    public void onChanged(ChangedEvent event)
    {
    if(fieldName.equals("Repair"))
    record.setAttribute("RepairHidden", event.getValue());
    else
    record.setAttribute("MACHidden", event.getValue());
    }
    });
    cb.enable();
    }
    else
    {
    cb.disable();
    }
    record.setAttribute(fieldName, "");
    d.setFields(cb);
    }
    else
    {
    record.setEnabled(false);
    return null;
    }
    }

    else
    return null;

    return d;
    }
    };



    gwt 2.0.3

    #2
    A better fix, which will increase performance in all scenarios (not just show/hide), is to use recordComponentPoolingMode:"recycle".

    Comment

    Working...
    X