optikalefx / OpenJS-Grid

OpenJS Grid is the easiest jQuery Grid ever. With very little work you can have a data grid that can do everything from sorting and searching to complex database queries. Best of all, its open source. So you can learn how it's all done.
http://square-bracket.com/openjs
MIT License
97 stars 48 forks source link

Where is "Add Record? #70

Open MGA555 opened 9 years ago

MGA555 commented 9 years ago

The video for version 1.4 illustrated how to implement the "Add Row" feature. However, I tried that and could not see that anything happened. I also noticed in your notes, that "Add Row" is listed as an enhancement to be included in version 3.0 I looked through the commits here, and did not see where the feature had been removed, but I realize that it could of been removed earlier than the first commit listed here. Do you have the ability to add a row/ to me that is a critical capability.

optikalefx commented 9 years ago

Adding a record was removed, and as of now I have no plans to add it back. Why? Because I never used it. I always needed something more advanced in my use. I would either a) need a dialog box with a form b) use a new page with a form or c) needed some custom processing before adding. Since there were just so many "non grid" cases for adding, I made it so that you can 1) add a button to add and 2) refresh the grid with previous params so that after your add, the grid is reloaded.

So TL;DR you should make your own add however you need to, and refresh the grid afterwards.

MGA555 commented 9 years ago

Thanks for the information.

I'd like to request you reconsider at a minimum including the ability to have a simple "Add a null record" button. My customers need to add records all the time, so within the original spirit and PR of OpenJS Grid, having users need to "roll their own" on this seems inconsistent with your declared goals for this product.

Even if someone did not want to have all the fields editable on the normal page, an "Add record" button could be used to take them to a different page, one where editing has been enabled, strictly for the purpose of adding a record. Any limitations and controls on who could access that page could nicely be left to us.

Thanks for considering.

optikalefx commented 9 years ago

What would the benefit be of a null record? 9 times out of 10 it wouldn't even show up in your grid. (Because the grid normally has where conditions limiting what has been selected). So you'd add a null record to your database and then nothing would show up on the grid. (most likely)

MGA555 commented 9 years ago

In my cases, there is always an ID, and usually a field that has a default value, so a "null record" is not really null, and they would be displayed. It would be a minor imperfection if you were required to display the Index to be able to use the feature I propose.

How did it work in version 1.4?

optikalefx commented 9 years ago

In V1.4 I added a null record. But in almost all cases it wasn't enough. I either needed to process something on the record first, or I needed to ask more data and it was a bad UX to add a record and then open a form. Or I needed to add data to more than 1 table at once, so adding a null record would only do half that job.

Sure adding a null record works for the simplest of cases, but once you start using the grid in real bigger projects, you never will use that simple case.

MGA555 commented 9 years ago

Not to be argumentative, but to provide you feedback from users, I will always have the simple cases, even when I start using the grid for bigger "projects". I have a number of eCommerce websites, and since the developer did a good job or normalizing the database, the are lots of simple tables, each of which potentially needs simple maintenance actions.

Also, if I can do half the job, in 2 simple steps I am done. As things currently stand, I need to get back to a somewhat distasteful (especially after achieving simplicity in the other areas) task to create code to add records.

Please reconsider this.

optikalefx commented 9 years ago

I can consider it, the PHP part of the code is actually still there in grid.php. It would only be a matter of adding an option to add the button that calls the method. So it's just a matter of adding a little javascript.

MGA555 commented 9 years ago

That would be great. Is there a commit on GitHub that "removed" that feature. I would be very happy to "turn it back on" in my local repo, and create a pull request if you wanted it.

optikalefx commented 9 years ago

1.4 to 2 was a total rewrite. So it's not gonna be that simple.