on 07-02-2007 5:05 AM
Hi All,
I want to disable button if node is null... I have written the code in wdInit()...
But it is not triggered....
IPrivateaView.IApplicantsListNode node = wdContext.nodeAView();
node1 = node.size()
if(node1 !=null)
{
wdContext.currentContextElement().setEnableMergeButton(true);
}
}
else
{
wdContext.currentContextElement().setEnableMergeButton(false);
}
Please Tel me how to do...
Thanks & regards
Mathi
Message was edited by:
Mathi s
Hi,
Create a calculated attribute and write the code to test the size of th node and return the value desired, bind the context attribute to the enabled property of the button.
Code is already their in the post.
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mathi,
wdDoInit will fire when first time you run the project. Dont put the condition inside wdDoInit method. It will not triggered.
Take a context attribute say isEnabled of type boolean"
Go to the View Layout and select button and bind context attribute isEnabled in the value of enabled properties of button.
Inside wdDoInit use this code.(First time)
wdContext.currentContextElement().setIsEnabled(false);
where you are populating your node use.
wdContext.currentContextElement().setIsEnabled(true);
Regards,
Mithu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mathi...
In order to make a button enable or disable you have to define an attribute in the context.(Say ButtonStatus) and make it type Boolean
Bind the enabled property of the Button UI element to this attribute.
In the wdDoinit()
write the coding.
int nodesize=wdcontext.node<"NodeName">.size();
if(nodesize==0)
{
wdcontext.currentContextElement.setButonStatus(false);
}
else
{
wdcontext.currentContextElement.setButonStatus(true);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Instead of
IPrivateaView.IApplicantsListNode node = wdContext.nodeAView();
if(node !=null)
try using
int size = wdContext.nodeAView().size(); //this will give the number of elements the node has
if(size != 0)
Message was edited by:
Leena Ramachandran
Message was edited by:
Leena Ramachandran
Message was edited by:
Leena Ramachandran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Say you have button named "Submit" asssociated with a action "Submit".
As suggested by others we will check the node size.And if node size is 0 we will disable the action associated with the button.This will automatically disable the button.
nodesize= wdContext.node(your node).size();
if(nodesize==0)
{
wdThis.wdGetSubmitAction.setEnabled(false);
}
else
{
wdThis.wdGetSubmitAction.setEnabled(true);
}
Hi Mathi,
Put this line of code in your wdDoInit of the view controller.
if(wdContext.node<your node>.size()==0)
{
wdThis.wdGetSubmitAction.setEnabled(false);
}
This will make the button disabled if the node is empty during view loading for the first time.
Once the view is loaded, and their is some action triggered, in that action you can again check if the node is empty.If it si not empty then you can enable the button.
Now this code can be in any action or naviagtion plug (like for =m this view you go to anothe view and come back,then if the Inound plug write this code) or if some action is trigered in the view which will load values in the node then write the code in the action method.
if(nodesize==0)
{
wdThis.wdGetSubmitAction.setEnabled(false);
}
else
{
wdThis.wdGetSubmitAction.setEnabled(true);
}
if you can explain your scenario when the node will have value and when it will not,may be i can help you more precisely.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.