This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
Hello Gurus,
How can I get the index of a row when it is added dynamically.
When user clicks on the "-" button he should get the index of the row on which he has clicked the button.
I have tried it using the code
var var1 = (data.Design_page1.Working_times_subform.Working_Table.Row1.instanceManager.count-1);
But it gives me the total row count.I want the index of the particular row.
Thanks.
Regards,
Nikhil
Solved! Go to Solution.
Views
Replies
Total Likes
On the "-" button use this.parent.parent.index to get the index of the row the button is in. the "parent" reference is used to move back up the hierarchy so if you had say a subform around the button in the cell you'd have to add another parent to find Row1.
So to delete the row try: _Row1.removeInstance(this.parent.parent.index);
Or this should work too: _Row1.removeInstance(Row1.index);
The underscore is a shortcut to the Instance Manager. You may want to avoid using it in object names, I'm pretty sure it's caused me problems in the past, I only use camel case for object names now (avoid dashes too).
You don't need to specify the entire path to the object you're trying to access. The "-" button being below Row1 can see Row1.
Views
Replies
Total Likes
On the "-" button use this.parent.parent.index to get the index of the row the button is in. the "parent" reference is used to move back up the hierarchy so if you had say a subform around the button in the cell you'd have to add another parent to find Row1.
So to delete the row try: _Row1.removeInstance(this.parent.parent.index);
Or this should work too: _Row1.removeInstance(Row1.index);
The underscore is a shortcut to the Instance Manager. You may want to avoid using it in object names, I'm pretty sure it's caused me problems in the past, I only use camel case for object names now (avoid dashes too).
You don't need to specify the entire path to the object you're trying to access. The "-" button being below Row1 can see Row1.
Views
Replies
Total Likes
Hi Jono,
Thanks for the help.This is excatly what I was searching for.
Also thanks for the insighful suggestions.I wil suerly try and avoid using underscores and dashes.
Thanks.
Regards,
Nikhil
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies