Hi,
the last version of the plugin 1.3.23 should fix the REST-API error “string,null
“.
For updating the table object via REST-API you first should get the unformatted table data.
In PHP you have to set the 3 parameter of get_field()
to false
.
$unformatted_table_data = get_field( 'fieldname', $post_id, false);
In JavaScript you can get the unformatted table data by the REST-API.
Then you can modify the table data object and update the field by the REST-API.
The unformatted table object of a field named “table” of an REST-API GET should look like this example:
{
"acf": {
"table": {
"acftf": {
"v": "1.3.21"
},
"p": {
"o": {
"uh": 1
},
"ca": "Table caption content"
},
"c": [
{
"p": ""
},
{
"p": ""
}
],
"h": [
{
"c": "Header, first cell content"
},
{
"c": "Header, second cell content"
}
],
"b": [
[
{
"c": "Body Row 1, first cell content"
},
{
"c": "Body Row 1, second cell content"
}
],
[
{
"c": "Body Row 2, first cell content"
},
{
"c": "Body Row 2, second cell content"
}
]
]
}
}
}
acf.table.p
This object contains table parameters.
acf.table.p.o
This object contains table options.
acf.table.p.o.uh
Determines whether a header should be used or not.
acf.table.p.ca
The content of the table caption.
acf.table.c
Array of table columns. Amount should always be the same as in the table header or body row arrays. This columns array was intended to hold columns parameters.
acf.table.c[0].p
First column, still unused parameter property.
acf.table.h
Array of the table header cells.
acf.table.h[0].c
Content of the first header cell.
acf.table.b
Array of the table body rows.
acf.table.b[0]
Array of the cells of the table body first row.
acf.table.b[0][0].c
Content of the cell of the table body first cell in first row.
I hope this helps.
Cheers, Johann
-
This reply was modified 4 months, 3 weeks ago by Johann Heyne.
-
This reply was modified 4 months, 3 weeks ago by Johann Heyne.