how to cancel the insert row?

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 cancel the insert row?

#1

Postby t4nu » Tue Dec 22, 2015 10:47 am

Hi,
I put the insertrow() when the user click add new item, but
I notice that just by issuing the insertrow(), the record is added. So when the user change his mind and click cancel button which just put the user to previous page, the record is already added with empty name.
Am I doing it the wrong way? Which actually when user click add new item I shouldn't issue insertrow()? or do I have to do something (like delete or issue cancel) when user click cancel button instead just take the user to the previous page?
Thanks in advance for the help.
0 x

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

#2

Postby Jon » Tue Dec 22, 2015 11:16 am

When you add a row, you also have the option of setting it as empty e.g.:

Code: Select all

tables.T1.insertRow();
tables.T1.setRowEmpty(true);
Empty rows are ignored when you subsequently do an updateTable(), but they aren't removed for display purposes. A row loses its empty status when the user enters something in the row. You get this behaviour for free if you use the Add Row Button on a Table Control instead of coding your own insertRow().

Another way to do this is just loop through the rows before you do an updateTable() and delete any empty rows (i.e. all the columns have null values).
0 x

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

#3

Postby t4nu » Tue Dec 22, 2015 11:20 am

So the empty row still has to be deleted manually, is that right?
Jon wrote:When you add a row, you also have the option of setting it as empty e.g.:

Code: Select all

tables.T1.insertRow();
tables.T1.setRowEmpty(true);
Empty rows are ignored when you subsequently do an updateTable(), but they aren't removed for display purposes. A row loses its empty status when the user enters something in the row. You get this behaviour for free if you use the Add Row Button on a Table Control instead of coding your own insertRow().

Another way to do this is just loop through the rows before you do an updateTable() and delete any empty rows (i.e. all the columns have null values).
0 x

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

#4

Postby Jon » Tue Dec 22, 2015 11:27 am

Not necessarily, it depends what you want to do with it. Usually users enter data and then eventually hit some sort of Commit button at which point you issue an updateTable() - this updates the database. If you make a row empty, it's ignored by updateTable() i.e. it won't end up in the database. But it is still visible to the user.
0 x

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

#5

Postby t4nu » Tue Dec 22, 2015 11:37 am

If the user close the application (close the browser), then he run the application again, will that empty record still visible?

Concerning the updatetable(), if there are several insertrow() as long as no updatetable() issued the record addition will not be inserted to the table, is that right?
Jon wrote:Not necessarily, it depends what you want to do with it. Usually users enter data and then eventually hit some sort of Commit button at which point you issue an updateTable() - this updates the database. If you make a row empty, it's ignored by updateTable() i.e. it won't end up in the database. But it is still visible to the user.
0 x

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

#6

Postby Jon » Tue Dec 22, 2015 11:41 am

1. No, the form starts over.
2. Yes, that's right.
0 x

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

#7

Postby t4nu » Tue Dec 22, 2015 12:28 pm

Thank you very much.
Jon wrote:1. No, the form starts over.
2. Yes, that's right.
0 x


Who is online

Users browsing this forum: No registered users and 17 guests