About the fields type table

A place for users and developers of the Xataface to discuss and receive support.

Postby 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
chus_leon
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

Postby 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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby chus_leon » Fri Jul 27, 2007 12:21 am

OK thanks again

Jesus
chus_leon
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm

Postby 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
chus_leon
 
Posts: 12
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 32 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved