ryansuitposungkono / openjs-grid

Automatically exported from code.google.com/p/openjs-grid
0 stars 0 forks source link

Adding a row requires two steps and generally requires that you "lose data" before you get the process right. #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Set up a basic grid. 
2.  Use the add button to add a row.
3.  When finished with the row, a natural inclination is to hit "Add" again, 
especially if doing a mass bit of data entry.  In the current incarnation of 
grid 1.6, the Add button refreshes the table and adds a new row, but never 
gives the user either the option to save the previous row.

What is the expected output? What do you see instead?

Depends on your choice of metaphor.  I'll go over what I would LIKE to see as 
well as your options.

I'd like to see Add be a strictly javascript operation, adding null rows to the 
grid, making the table "dirty" and available for saving.  I would like the 
option to control messaging if an uncommited save is not present.  i.e. I hit 
refresh and I get a message, Hey "GridTable X" has some unsaved changes, are 
you sure you want to leave?"

Another option is to create an Add+Save Changes button, where it saves changes 
present.  But I don't like this as much because it requires logic to determine 
whether or not the table is dirty, whether or not it SHOULD autosave, and often 
during data entry you don't necessarily want to always wait for the changes to 
post and the grid to reload EVERY time you hit add.

So while the 2nd mode people can live with, I think the immediacy of a 
javascript add row and the metaphor being, I am in complete control of when 
things get saved, and if I think it's all crap, I don't have to live with it 
would really make your grid tool stand apart.

What version of the product are you using? On what operating system?
1.6 on PC/Mac Safari + Firefox testing (latest builds as of this date)

Please provide any additional information below.

Original issue reported on code.google.com by vep....@gmail.com on 8 Apr 2011 at 4:27

GoogleCodeExporter commented 9 years ago
I really like this idea, and have heard it from multiple people.
The thing to figure out though - is that you can't always just add a blank row 
with javascript. In a lot of case you need to set some data along with the new 
row.  Such as adding a new order for a user grid. You need to add a new row 
WITH the userid and userid probably isn't on the grid cuz your on the user page.

So i need to figure that part out.  It may be an ajax operation to get the 
extra data then create the dirty row. But im not sure yet.

Original comment by s...@square-bracket.com on 10 Apr 2011 at 3:16

GoogleCodeExporter commented 9 years ago
The notion of adding a blank row should be handled in the ->add() callback.  If 
a primary key is needed, then getting that key should only occur on the actual 
adding of the row, IMO.  Although maybe you're thinking of an edge case that 
I'm not considering.

What do you mean by adding a new order for a user grid?  It would seem to me 
that default values are already set, and if there is a primary key that needs 
to be addressed/saved, you have a choice as the programmer to either do it 
yourself or let the underlying DB handle it (via autoincrement, etc.)

Or am I missing the point?

If you HAD to get a derived value from the backend, then yes, a ajax operation 
might be needed for initial population, although technically you're doing that 
anyway via the ->select() editables (although not sure if you do a lookup every 
time or load the lookup data once and then reuse it throughout the whole grid.

Original comment by vep....@gmail.com on 12 Apr 2011 at 9:19

GoogleCodeExporter commented 9 years ago
For example.  Lets say I have a grid of videos that a user has permission to 
view. So on the users page I have a grid of tutorials.

As an admin, i want to add a new video permission to that user.  I can't just 
add a null row to the user_permissions table. I have to also specify which user 
i'm adding for.  And the user_id is not on the grid, because your already on 
the user's page.

So you see, I need to somehow pass extra data long when adding a new row, 
because sometimes you have dependent data that needs to be set along with the 
new null row.

Original comment by Seancla...@gmail.com on 13 Apr 2011 at 4:49