About the fields type table

Archived from the Xataface Users forum.

chus_leon — Thu Jul 26, 2007 1:30 am

I need some idea or documentation about the creation of the fields defined as widget:type=table

Is it possible?

Initaly the framework displays two new buttons, one for create a new row and another one for delete row. How can I complete or use this feature?

Best Regards


shannah — Thu Jul 26, 2007 11:16 pm

When using widget:type table, it will store the data as XML. So the field type must be TEXT (or varchar… but text is better).

You can decide which columns you want in the table by creating sub-fields in your fields.ini file as follows.

Suppose you want a column called ‘name’ and a column called ‘url’

[myfield]
widget:type=table

[myfield:name]
[myfield:url]

Now when you access the stored value using the Dataface API, the value of myfield will be stored as an array of associative arrays.

e.g.

foreach ( $record->val(‘myfield’) as $vals){
echo $vals[‘name’].’ – ‘.$vals[‘url’];
}

-Steve


chus_leon — Fri Jul 27, 2007 12:21 am

OK thanks again

Jesus


chus_leon — Fri Jul 27, 2007 1:33 am

Good morning (in Spain) Steve

There is a little bug on IE7. Everything runs fine over Firefox but using IE7 the button don’t add a new line. IE, when it charges the page display an error on the page.

And a question, is it possible to create a summary field of this subfields? Like a total of an invoice

Regards

Jesus