cancel
Showing results for 
Search instead for 
Did you mean: 

C4C SDK: Delete selected record in Advance List Pane

chandansb
Active Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Chandan,

Make sure that you have followed all the given steps:

  1. Add layoutstack panel.
  2. In properties goto Misc->Items.
  3. One popup window will come. click Add
  4. There in Events->Onclick->create new event as shown

Hope this works for you.

As per my knowledge,there is no need of custom action to delete.

Regards,

Komal

chandansb
Active Contributor
0 Kudos

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

former_member200567
Active Contributor
0 Kudos

Hi Chandan,

It would be really helpful if you show your binding with a screenshot.

Best Regards,

Fred

chandansb
Active Contributor
0 Kudos

Here you go, Fred.

Weird part is I was only able to see my Action only when I go into ToParent (anyway was the first time I dealing with using BOAction, so not very sure. You see I am trying my best to learn SDK this time )

Let me know in case if you need anything else to help me

Regards,

Chandan

Answers (3)

Answers (3)

chandansb
Active Contributor
0 Kudos

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

former_member200567
Active Contributor
0 Kudos

This is really great.

Cheers,

Fred

chandansb
Active Contributor
0 Kudos

Hello Fred,

Thanks, indeed great learning for me.

However I am still unable to figure out why this situation? Deleting last entry don't refresh the List to show no values (Empty Advance List Pane).

Any hint will be helpful.

Regards,

Chandan

former_member200567
Active Contributor
0 Kudos

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

chandansb
Active Contributor
0 Kudos

Thanks Fred for details steps that you performed for me.

I will check once again my solution and will surely provide my feedback on this.

Thanks,

Chandan

former_member200567
Active Contributor
0 Kudos

Hi Chandan,

Never mind. Let me know if you encounter any issue.

Update: 1) b) NodeID is not needed to bind with the button.

Note: RemoveRow of ALP cannot be used if data list is bound with a custom query in data model. (not your case, just FYI)

Cheers,

Fred

former_member187060
Participant
0 Kudos

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.

chandansb
Active Contributor
0 Kudos

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

former_member200567
Active Contributor
0 Kudos

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

chandansb
Active Contributor
0 Kudos

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

former_member200567
Active Contributor
0 Kudos

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

chandansb
Active Contributor
0 Kudos

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