Hi,
During the saving of an inline edit, I'm generating the update query
with JavaScript on the client side, and posting it to tbl_replace.php,
which prepares some variables for sql.php. sql.php then executes the
update query, and generates an output in JSON, which is evaluated by
jQuery at the client side. If the query has been successful, the
values that were in the textarea/input fields, are taken as the new
value for that field and the HTML is updated to that effect.
The above process creates a few problems for me. When the table being
edited has a foreign key or transformed field, the javascript does not
know what is the value to be displayed after a successful edit. For
the foreign keys, I am generating the anchor at the server side in
sql.php and adding it to the JSON output. However, the anchor is not
being generated correctly, as the WHERE clause is missing. After the
query has been executed, sql.php does not know the values of
individual fields, and hence, I cannot generate the WHERE clause
necessary for the anchor.
Similarly, for transformations, I don't have the value of the field,
and hence, I cannot transform the new value to generate the HTML,
which I can add to the JSON output.
In libraries/display_tbl.lib.php, the WHERE clause is generated on the
fly for each field, as '= <field's value>', while the transformation
is done in the function PMA_prepare_row_data().
The solution I have in mind for the transformation problem is to post
an associative array to tbl_replace.php containing the field name and
it's new value, which I'll use after the query has been executed and
generate the HTML with this array. As for the first problem (foreign
key's anchor), I've been stuck at it for some time and can't see a way
out.
Could someone suggest a better solution?
Thanks!
--
Ninad S. Pundalik