on 2016 Aug 10 10:13 AM
Hello Experts,
I have created a custom solution with a node that is binding to advance list pane. For this I have also provided an DeleteBin Icon on every row so that user can delete the specific record. Refer the below screenshot:
As of now irrespective to which record I try to delete, first one which is marked in red above gets deleted. In my Event Handler, I have added BOAction that has instance Binding to my DataList but somehow I can see in debug that all the 4 records are picked up and maybe that why my below line of code in my Action deletes first record:
this.fieldRules.Delete();
Kindly throw some lights how I will be enabling deletion of the selected record.
Thanks & Regards,
Chandan
Request clarification before answering.
Hi Chandan,
Make sure that you have followed all the given steps:
Hope this works for you.
As per my knowledge,there is no need of custom action to delete.
Regards,
Komal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Komal,
Thanks for replying
I tried this method too.
I performed step 1, 2, 3 (added my Icon here) and 4 to define my event.
Similar to your suggestion, I added 3 steps:
1. List Operation to RemoveRow
2. WindowAction to Save
3. Additionally I also added List Operation to Refresh the List.
But not sure why I get dump.
What do you think must be the issue for this dump.
Regards,
Chandan
Hello MOHD SIRAJUDDIN, Komal Choudhary & Fred K,
I switch to try again the Event where I have used (same that was suggested by Komal and Siraj):
1. RemoveRow method for List.
2. Save
3. Refresh the List.
I worked fine now. Maybe I forgot to maintain the Target List in the third step (List Refresh) that threw the dump earlier. Now the delete icon that I click, deletes the same row it is in and refreshes the List after saving.
Only one issue now. I had 4 rows in my ALP. I deleted all one by one for testing. All worked as expected, unless there was only one row left. When I deleted this row, I could see some processing on screen followed by Save. But I can still see the left row on screen. Technically the row was deleted, but still visible on screen!!
When I try to delete it again, it throw dump (as expected since row was already deleted) When I reopen the same record again. I can now see my ALP empty as expected.
Any suggestion why this happens and how I will handle this situation?
Your inputs on this discussion was really very valuable for me to learn and I am sure for many in future.
Thanks for replying folks.
Regards,
Chandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandan,
Sorry, I thought you solved everything, my bad.
I just tested both scenarios, using BOAction and using RemoveRow of ALP.
Both work fine as expected.
1. BOAction
a) Declare a BOAction in the node.
node item[0,n]{
element itemID: ID;
element itemDesc : apCommonGDT:LANGUAGEINDEPENDENT_EXTENDED_Text;
action nodeDelete;
}
b) Bind ALP with node in data model
c) Add BOAction to delete and refresh the list (Save after execution is not needed if you don't want)
c) Change input type of NodeID column to Button or icon and bind the created handler with onClick event of the button.
d) Result
2. RemoveRow of ALP
a) Add List operation and bind with onClick event of a row button. (Window save is not needed if you don't want)
b) Result
RemoveRow of ALP is much more recommended.
Best Regards,
Fred
Hello Chandan,
If you are using Delete Bin icon for deleting the selected record then no need of custom action just follow.
1. On Delete bin icon onclick event create Event handler.
2. Select list operation from the list of events available.
3. Select operation as remove row
4. Select the target list (your node data list);
4. And also include another event windows action and select the action type as save it will save the entries after record gets deleted.
Thanks,
Siraj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Siraj,
Thanks for replying.
As mentioned to Komal, I did performed the mentioned steps but facing error.
Apart from that I also tried the third step that is mentioned by Sunil Kumar Maurya in another discussion:
How to add DELETE functionality to an OWL autog... | SCN
As seen there, I added BOOperation to read the Unique ID from the Data List before my BOAction. Doing so I ended up deleting not only the selected record but also the complete DataList (all 4 records) + Header Data.
You see I am trying all possible learnt option that I came across on this forum making my solution a Hybrid Solution now.
So I have reverted my solution back to what I mentioned in this discussion as the situation and kept trying. Meanwhile thought posting here to know what exactly is missing.
Regards,
Chandan
Hi Chandan,
It seems you added the BOAction in the root node in business object definition.
You have to add the BOAction in the fieldRules node.
->this.fieldRules.Delete();
It is a bit strange that your code doesn't have a GetFirst() even you are accessing the instance of the fieldRules node.
Best Regards,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Fred,
Yes you are right. I have the Action on BO definition on root but performed instance Binding to my DataList and then bind the custom Action selecting fieldRules-->ToParent --> delete(my Action).
As mentioned as the result, I can see 4 records selected and the very first getting deleted.
I also referred your suggestion in previous discussions:
SAP Cloud SDK : Read Current Selected Record fr... | SCN
But I was not able to find OnLeadSelectionChange as what Mithun Sutharmentioned in this discussion
Regards,
Chandan
Hi Chandan,
Node is like a separate business object. (that's what I consider)
Node elements and Node actions are instance based.
So, get the instance and access its elements or actions.
1. You need to definitely add the BO Action to the item node in business object definition
2. Bind the Root with Root node and bind the data list (advanced list pane) with the item node (that's how you get the instance) in data model.
3. Add the event handler as you usually do and bind with the BOAction under item node.
Best Regards,
Fred
Hello Fred,
Meanwhile, I indeed followed your suggestion and added the Action under my node and provided Instance binding to this Action. In DataModel, Root is bound to Root Node and Data List with my node fieldRules.
Result, now whenever I delete any of the row ... Last row gets deleted !!
Now I am trying to understand what is happening here
Regards,
Chandan
User | Count |
---|---|
59 | |
7 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.