Hi,
thanks for your post, and sorry for the trouble.
Sorry, that’s not that easy. Editing tables should only be done via the “Edit” screen, there’s no direct PHP API.
You would have to load the table using the TablePress table model, then edit the array and save it again. For details, I suggest to take a look at the TablePress source code, specifically at the ajax_action_save_table method in the controller-admin_ajax.php file.
Regards,
Tobias
but that’s stored into the db, so it should be at least possible to just find the row and update it right?
well I was able to use PHP and your static methods to manipulate programtically the table
$existing_table = TablePress::$model_table->load( 1, true, true );
$existing_table[‘data’][]=array(0 => ‘value’,
1 => ‘value’,
2 => ‘value’,
3 => “value”,
4 => “value”,
5 => “value”);
$existing_table[‘visibility’][‘rows’][]=1;
$saved = TablePress::$model_table->save( $existing_table );
And it works too
Is there any way to just load a row?
this loads all the data from ALL the table…
Hi,
yes, that code looks good! Great to hear that you found that!
Loading just a single row (just like directly adding only a single row) is not possible, as TablePress doesn’t stores tables by row, but only the full table (a two-dimensional array) as a JSON encoded string in the wp_posts table.
Regards,
Tobias