Search Support
-
RameshkumarAugust 12, 2015 at 1:37 pm #650
we have a following requirement, please let us know, how we can achieve that ?
1. When we display the data on the table, existing record from DB should be shown without delete button. But when you add a new row, delete button should be visible.
2. Can we achieve this by using OOTB delete button ?
3. If we can’t achieve with OOTB, can we use removeRecord ? I have tried this option, but it did not work. Please let me know the solution.
Stephen PerezAugust 12, 2015 at 2:59 pm #651Hi Ramesh, can I ask how you’re using removeRecord? You are correct in that you should be able to achieve the desired functionality using this method, as there is no easy OOTB way of doing this otherwise (you could potentially use the On New Cell method, but this could get complicated fairly quickly). As long as you are passing in the index of the record to be deleted, removeRecord should work for this just fine though.
RameshkumarAugust 17, 2015 at 1:46 pm #664Hi Andrew,
Please find the attachment. I have created a icon as a column and used the removerecord function on click of the icon.
Not sure what I am doing wrong. Please point me out.
${Table1}.removeRecord(1) ;
Regards,
RameshElliotAugust 18, 2015 at 2:25 pm #677Hey Ramesh,
I managed to find a way to accomplish what you need. Due to the scope of where the nested buttons are, they are unable to reference the table directly, but you can call upon a function to perform the same logic. To do this, you would need to add a Custom HTML control to the coach, and within script tags use this code:
function Delete()
{
var table = page.ui.get(“Table1”);//the table control IDtable.removeRecord(0); //or whatever index you need
}
Then within the button OnClick() event, add @Delete();
Hope this helps!
-Elliot P
RameshkumarAugust 19, 2015 at 11:40 am #681Thank you. Could you please let me know, how to get the selected index ? I tried to use getRow function and getData() to find out the bound variable, but nothing helps.
Stephen PerezAugust 26, 2015 at 9:02 am #691You actually should be able to access the table itself using ${../Table1}, instead of a custom HTML method. To actually access the index of the row, you can actually use the ui namespace. All controls inherit several methods from here, including a method called getIndex(), which gets the table index for a control. So in the On Click method of your icon, the code would look something like this:
${../Table1}.removeRecord(me.ui.getIndex());
-
|
You must be logged in to reply to this topic.