i have a problem in my SmartGWT-Application.
I should display different Organisations in a Menu where the user can see them and can change his Organisation.
But the thing is, he should see the active Organisation, see that the specific Organisation is active, but he should't be able to click it.
Here is my code so far:
if(menuItemList[location].getAttribute("id").equals(USER_MANAGER.getUserOrganisation())){
menuItemList[location].setChecked(true);
menuItemList[location].setCanSelect(false);
}else{
menuItemList[location].setChecked(false);
menuItemList[location].setCanSelect(true);
}
The Problem is, that SmartGWT doesn't show the Checked-Icon (checkmark) if the MenuItem is "canSelect(false)".
Also there isn't a difference in the generated HTML code that let me see if the MenuItem is that with the active organisation.
Does anyone have a workaround or know what i did wrong?
I found the solution:
I've used the wrong Event-Handler for what i wanted to do.
Since i let the MenuItem's generate with DataSource and not Directly, those elements don't exist at the moment of the Code execution
previously i've used the DrawHandler()
and the Element hasn't had the ID at this moment(at least i think that).
that's why my if(){}else{}
won't do as i wanted it to.
But with the MembersChangedEvent
, the code is executet after the Element gets it's id and therefore the Elements can check their ID with the one from my USER_MANAGER
.
Hope this helps somebody with the same problem