0

I have used CheckboxTreeviewer with ICheckStateListener to get a checked elements. if element get checked then create a new set of object and setInut in same CheckboxTreeviewer.but when I put the new set of object in CheckboxTreeviewer previously checked elements unchecked.

code -

  chboxtv.addCheckStateListener(new ICheckStateListener() {

    @Override
    public void checkStateChanged(CheckStateChangedEvent event) {
        String child=null;
        String parent=null;
        Object obj= event.getElement();
        if(obj instanceof Children){              
            Children child=(Children)changed;                    
            childvalue=child.getChildren();
            rootvalue=child.getParent();
            List<Parent>  pList=getResult(rootvalue,childvalue);
            //Getting previously checked element.
           Object [] chek=  chboxtv.getCheckedElements();                                                  chboxtv.setInput(pList);                                
               chboxtv.expandToLevel(3);
               chboxtv.setCheckedElements(chek);
        }                
    }
});

In my condition always presents previously checked elements value in new set of object.

How to checked previously checked elements when new set of object load in CheckboxTreeviewer.

please see the Answer of this question

CheckboxTreeviewer previously set checked elements after reload

but still my problem is not solve. I am wasting two days on it.

How to achieve this?

Community
  • 1
  • 1
  • You haven't provided any more information than is in the linked question so how can we provide any more help? Exactly what are you having problems with? What have you tried? – greg-449 Dec 21 '16 at 16:20
  • @ greg-449 when I check a element reloading the CheckBoxTreeviewer with new value of set. but I have set previously checked element with checked mark. – Rameshwar Nagpure Dec 21 '16 at 16:25
  • As I already said if you are calling setInput you will have to make up a new list of all the items in the new input you want to have checked. getCheckedItems will give you the old checked items, you have to match that up with the new input - I can't tell you how to do that because it depends on how your classes work. – greg-449 Dec 21 '16 at 16:37

0 Answers0