widget atts size for lookup field
Archived from the Xataface Users forum.
fabiofromfrance — Mon Mar 08, 2010 5:41 am
I am trying to change the size of a fields using
- Code: Select all
widget:atts:size=50
but it doesn’t work with lookup field. Any idea why? and how to change filed size of a lookup type?
- Code: Select all
[adr_id] widget:atts:size=50 widget:type = lookup widget:table = adresse
Thankyou
shannah — Tue Mar 09, 2010 8:45 am
The lookup widget looks like a regular text field but is not… That said, this may be a bug… i’ll look into it.
ADobkin — Sun Aug 21, 2011 10:31 pm
Has this issue been resolved? It seems like the lookup widget field size is fixed to about 20 characters, and it does not respond to the widget:atts:size directive or the other widget:atts directives.
Thanks,
Alan
shannah — Mon Aug 22, 2011 1:50 pm
No. Hasn’t been fixed. You can use CSS as a workaround for now. E.g. The display field portion of the lookup widget has the CSS class:
xf-RecordBrowserWidget-displayField
-Steve
ADobkin — Wed Aug 24, 2011 3:59 pm
That works just fine, thank you. I have added this to the bug tracker as well for future reference, but I am fine with the CSS workaround in the meantime.
muhyi — Sun Apr 22, 2012 5:56 am
Hi steve, ADobkin, fabiofromfrance,
How do I make the class as discussed here? In which folder and which css file?
shannah — Sat Apr 28, 2012 9:51 pm
You can add your own CSS file in many ways. The most usual way that I do it is using the Dataface_Application::addHeadContent() method to add a tag with the stylesheet in the head of the output. I usually call this from the beforeHandleRequest() method of the Application Delegate class because it runs in every request.
e.g.
- Code: Select all
function beforeHandleRequest(){ $app = Dataface_Application::getInstance(); $app->addHeadContent('<link rel="stylesheet" type="text/css" href="path/to/my/styles.css"/>'); }
-Steve
muhyi — Sun May 20, 2012 7:21 am
Many thanks, Steve, for your response. I will try and use this in my application.
muhyi — Sun May 27, 2012 12:05 am
Hi Steve.
I still can’t set the width of the lookup field. I understand about the beforeHandleRequest() and the css file location. But I still can’t set the proper css file for xf-RecordBrowserWidget-displayField class. The width is still the default width. Can you give me a simple example for defining this class in a css file?
Thx.
shannah — Mon May 28, 2012 12:22 pm
Change width of all lookup fields:
- Code: Select all
.xf-RecordBrowserWidget-displayField { width: 400px}
Change width of only the lookup field in the firstname field of the people table:
- Code: Select all
#people-firstname-wrapper .xf-RecordBrowserWidget-displayField { width: 400px}
-Steve