Page 1 of 1

PostPosted: Thu Jul 26, 2007 1:30 am
by chus_leon
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

PostPosted: Thu Jul 26, 2007 11:16 pm
by shannah
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

PostPosted: Fri Jul 27, 2007 12:21 am
by chus_leon
OK thanks again

Jesus

PostPosted: Fri Jul 27, 2007 1:33 am
by chus_leon
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