ftopolovec / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

additional param for ajax calls #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I must say - great work!
1) It would be nice if you could add an additional parameter for SQL table 
name. This parameter will allow plugging in any SQL table without modification 
of server side scripts for add/update or delete.

I did a tiny modification of your code to accept something like this:

oTable.makeEditable({
sSqlTableName: "my_table",
sUpdateURL:  "UpdateRow.php",
etc...

The result is that various pages can use different table names, but all use the 
same UpdateRow.php (which is capable to find a primary key and column name from 
table name and column number).

2) Also, I would not force having input form when adding a new row. At the 
moment: no form - no Add button:-). One might choose to add a new, empty row 
and populate it with data later. In SQL this is done simply by:
INSERT INTO my_table DEFAULT VALUES

Alex

Original issue reported on code.google.com by alex....@gmail.com on 14 Jun 2011 at 1:32

GoogleCodeExporter commented 9 years ago
Thanks, I'm glad that you like it.

1) Regarding the additional parameter could you try to add it into the 
sUpdateURL parameter e.g. sUpdateURL: "UpdateRow.php?sSqlTableName=my_table"? I 
think that this will work.

2)Someone already asked me for this excel like adding new rows but in the near 
future this will not be implemented. When new row is added to the table it must 
have valid id into the TR therefore it must be saved into the database. This is 
a special case where the row can be added without any validation on any field 
(allowed all blank values) and this is not common case. Also, if I add blank 
row, first cell you edit migh cause the row to be moved in the table according 
to the sort condition that is currently applied. This way the blank row will 
just jump-off first time you enter any value in the cell. There were few other 
issues in this scenario and therefore I have abandoned this idea.

Regard,
Jovan

Original comment by joc...@gmail.com on 14 Jun 2011 at 10:28

GoogleCodeExporter commented 9 years ago
Hi Jovan,

Thank you for the reply, and just a small comment:

UpdateRow.php?sSqlTableName=my_table 
won't work since you allow only POST method for update calls with predefined 
parameters. Perhaps, in addition to sAddHttpMethod and sDeleteHttpMethod you 
can also add "sUpdateHttpMethod" so user can choose GET and pass additional 
parameters as you suggested.

Or if you want to stay to POST only, you can add an option for user to add his 
own parameters.

Again, great plugin.

Alex

Original comment by alex....@gmail.com on 15 Jun 2011 at 7:14

GoogleCodeExporter commented 9 years ago
Sorry I have not noticed that we are talking about update :). I do not have 
much control in update mode because I just pass parameters to the JEditable 
plugin so method that will be used should be set as a parameter of the custom  
column editor. You can set "method" parameter in the individual column editors 
(see example in the 
http://jquery-datatables-editable.googlecode.com/svn/trunk/custom-editors.html 
although here I have not set "method" param). If individual column editors are 
not used default JEditable configuration is used for all editors.
You can see all options that cna be set here in jquery.jeditable.js source or 
on the jeditable site.

Original comment by joc...@gmail.com on 15 Jun 2011 at 12:07

GoogleCodeExporter commented 9 years ago

Original comment by joc...@gmail.com on 15 Sep 2011 at 8:54