on 07-03-2008 12:58 AM
Hi Friends,
I have a requirement some thing like this, please guide me how to solve this. I have a table with three columns ItemNo(dropdownbykey with pre-existing itemnumbers ), Name, Date. I have a button called add to add the new items to this table.After adding a new item I assing a ItemNo from the dropdownbykey with pre-existing itemnumbers and change the date and name then I hit save to save the new item which is added to this table. Now after i hit save i want to make the ItemNo(dropdownbykey with pre-existing itemnumbers ) field readonly. becaue i do not want users to cahnge the item number. The users should only allow to change the ItemNo during the first time. Once they add the record and assign the Item number and they should not allow to change the ITem Number. Please advice. Thanks in advance
Peter.
Friends,
I appreciate your time to answer my question.
I tried same way and it's working fine but this is only working for first time. if i create a secound item i should be able to assign the ItemNo from the drop down. but not able to assign Item No for the secound one because it's already disabled. I am thinking , how can i make this specific table cell only readonly after hit save. Not for all rows.
Peter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What exactly did you try?
Let's say you want to always use the first table row to edit/add a new entry and you have an action handler method onSaveEntry() like this:
void onSaveEntry(...)
{
/* make item list box of first (currently edited) row read-only: */
IItemsElement item = wdContext.nodeItems().getItemsElementAt(0);
item.setItemNoReadOnly(true);
/* Insert new item at index 0 */
item = wdContext.nodeItems().createItemsElement();
wdContext.nodeItems().addElement(0, item);
/* set initial values for item attributes if needed... */
}
Armin
Thanks for quick turn.
First:
Adding an item to the Table, When i add an item i am doing this:
addItem(){
IPublicABCComp.Item2Element Item = wdContext.nodeItem().createItemElement();
wdContext.currentContextElement().setReadOnlyAfterSaveAs(false);
Item.setName("");
Item.setDate(new java.sql.Date(new GregorianCalendar().getTimeInMillis()));
}
wdContext.nodeItem().addElement(0, Item);
I am doing this in saveEntry() method
//here adding the values to the backend and setting the readonly true as below
wdContext.currentContextElement().setReadOnlyAfterSaveAs(true);
When i add an Item , the whole coulm read only become false instaed of that specific cell variant.
If I hit on saveItem, the whole column changing to readonly true.
if this behaviour occurs only cell level then i will be fine.
Thanks
Armin
i think the better option will be including the ReadOnlyAfterSaveAs(boolean) attribute in to the table node itself as armin suggested.
Items (node, 0:n)
-- itemNo (string)
-- name (string)
-- date (date)
-- itemNoReadOnly (boolean)
on AddItem
addItem(){
IPublicABCComp.Item2Element Item = wdContext.nodeItem().createItemElement();
Item.setReadOnlyAfterSaveAs(false);
Item.setName("");
Item.setDate(new java.sql.Date(new GregorianCalendar().getTimeInMillis()));
}
wdContext.nodeItem().addElement(0, Item);
on saveEntry()
wdContext.currentItemElement().setReadOnlyAfterSaveAs(true);
nikhil
Say your context looks like
Items (node, 0:n)
-- itemNo (string)
-- name (string)
-- date (date)
-- itemNoReadOnly (boolean)
Bind the "readOnly" property of the drop-down list to attribute "itemNoReadOnly". In the method that saves an item, set the "itemReadOnly" attribute value to true.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Write a condition when to disable the drop down, there in that just disable the dropdown by key by making the visibility to false. or as said above make the context property (enable) to false.
regards,
Pradeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create an attribute of type boolean and map this with the enabled property of the dropdown UI available in the table. Now onAction of save make this property to false using the code below:
wdContext.currentContextElement().setDDEnabled(false);
// DDEnabled is the name of the attribute of boolean type.
Hope this helps.
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Create an attribute of type boolean, bind it to DDByKey's enabled property.
OnActionSave()
you can set attribute to false to make DDByKey UI disabled.
wdContext.currentContextElement().setDDEnable(false);
// wehre DDEnable is the attribute bind to enabled field of DDByKey UI element
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.