remove the sectionlayout using button

Certified Lead Developer

hi,
i using button component to remove the section layout,
i am using the following code

a!sectionLayout(
contents: {
a!textField(
label: "Risk 1",
labelPosition: "ABOVE",
placeholder: "<Insert a transaction Risk.>",
value: ri!input.Risk1,
saveInto: ri!input.Risk1,
align: "CENTER"
),

after this i using the remove() function,
"saveInto:{

a!save(ri!input.Risk1,remove(ri!input.Risk1,index(ri!input)))

}
i am unable to delete the section 
i looking for suggestion to modify the scripts and work done.

regards 
srinivas

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Then please try the code mentioned in above comments. That should resolve your issue.
  • 0
    Certified Lead Developer
    in reply to Srinivas Thota

    Hi @srinivas you cannot compare a Normal section behaviour with an editable grid.

    I mean to say, when you click on delete icon within an editable grid, 1 row gets deleted from your DB, and because this row do not exist hence one row will be disappeared from your grid.

    But when we talk about section, you can hide this section conditionally, let's say, you want to delete a row from db which is currently being display in this section, in such case you can have a delete button which invoke delete from data store entity smart service function to delete this row based on given identifier, and you can make the use of showWhen property of section layout where if the data do not exist, do not show this section.

    But still we can't call this as deletion/removal of section layout, instead we can call it as display section layout conditionally or hiding the section layout based on some certain condition.

    Hope this will help you.