control where a vocabulary is used in the gui

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

Postby Scott » Tue Apr 10, 2007 6:03 pm

hi Steve,

i would like to use something similar to the vocabulary:existing feature.

if a vocabulary is defined for a field in fields.ini then dataface will automatically use it in the list view, the detail view and the edit view (or anywhere where that field is represented).

however, i want to use a vocabulary in the edit view that is too limiting to be automatically used in the list view.
when i tried it out, i noticed that the values the vocabulary are being used to (try to) populate ALL the rows in the list for the corresponding column.
so with my "special" vocabulary the editview selectbox got exactly what was needed but the listview rows got only partly filled for that fieldcolumn.

is there a way to let dataface know where the vocabulary is to be used? (similar to vocabulary:existing)
i.o.w. i need to connect a vocabulary not only to a field but also to the place in the gui where that field is filled by the vocabulary.
something like vocabulary:recordedit, vocabulary:recordview and vocabulary:list.

maybe those aren't even specific enough. it could even be possible that the same field needs to be represented more than once in the same view but via a different vocabulary. maybe that is taking the concept quite far but it seems logical to me.

i hope you understand what i mean to accomplish. if not, i can provide an example scenario with real tables and fields etc.

Scott.
Scott
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Apr 10, 2007 8:34 pm

Hi Scott,

I wish there were currently a more slick way to handle this situation in dataface, but for now you have to identify it on an action-by-action basis.
you could do something like this:
function valuelist__foo(){
ÊÊÊ $app =& Dataface_Application::getInstance();
ÊÊÊ $query =& $app->getQuery();
ÊÊÊ switch ($query['-action']){
ÊÊÊÊÊÊÊ case 'edit':
ÊÊÊÊÊÊÊ case 'new':
ÊÊÊÊÊÊÊÊÊÊÊÊÊ return array(0=>'val1', 1=>'val2', .... etc..);
ÊÊÊÊÊÊÊ default:
ÊÊÊÊÊÊÊÊÊÊÊÊÊ return array(6=>'val6', ...etc ..);
}
in other words you define a valuelist using the delegate class but you have the valuelist return different values depending on the action being performed.
This is not perfect since you may have other actions besides 'edit' and 'new' where you want the smaller valuelist.
It is important that the valuelists returned in edit and new actions must be subsets of the valuelist that is returned the rest of the time.
Best regards
Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Scott » Wed Apr 11, 2007 3:37 am

Thanks! i will use that, it's actually pretty slick already :)
And it seems to be enough for what I want to do.

Scott
Scott
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 4 guests

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