how to get selected data?

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

how to get selected data?

#1

Postby t4nu » Thu Jan 14, 2016 10:43 pm

Hi,
I have the grid in my application, and there is select column in it.
Now I want that if the user select the row and click the edit button I can get the selected key value and sent it to the edit page to be edited :lol:
How to do it? I mean get the row data.
Thanks in advance for the help.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Fri Jan 15, 2016 8:44 am

You just need to loop through the table rows and check if the row is selected, then go directly to the edit page. This sets the table's current row to the selected row, so when when you display the table columns on your edit page, the correct data will automatically be displayed and edited.

Code: Select all

var rows = tables.T1.rows;
while (rows.next())
{
	if (tables.T1.isRowSelected())
	{
 		form.gotoPage(pages.editPage);
	}
}
Documentation: http://dev-docs.verj.io/ufs/doc/table_d ... c257106253

But usually there is an easier way: change one of the table columns - something that uniquely identifies the row such as the id or name - to be a hyperlink. Add a script to the hyperlink on click event with the following code. Then you don't need a select column at all.

Code: Select all

form.gotoPage(pages.editPage);
0 x

t4nu
Ebase User
Posts: 305
Joined: Thu Jul 02, 2015 8:32 am
Location: Indonesia

#3

Postby t4nu » Fri Jan 15, 2016 5:04 pm

Hi,
Thanks for the explaination and also the tips.
Jon wrote:You just need to loop through the table rows and check if the row is selected, then go directly to the edit page. This sets the table's current row to the selected row, so when when you display the table columns on your edit page, the correct data will automatically be displayed and edited.

Code: Select all

var rows = tables.T1.rows;
while (rows.next())
{
	if (tables.T1.isRowSelected())
	{
 		form.gotoPage(pages.editPage);
	}
}
Documentation: http://dev-docs.verj.io/ufs/doc/table_d ... c257106253

But usually there is an easier way: change one of the table columns - something that uniquely identifies the row such as the id or name - to be a hyperlink. Add a script to the hyperlink on click event with the following code. Then you don't need a select column at all.

Code: Select all

form.gotoPage(pages.editPage);
0 x


Who is online

Users browsing this forum: No registered users and 19 guests