Change number of checkbox columns

A place to discuss development of the Xataface core.

Change number of checkbox columns

Postby ururk » Fri Jan 07, 2011 8:22 am

Is it possible (with a setting) to change the number of columns displayed? I'd like to switch it to 2 columns, from three. I poked through the php files, but haven't found where this is set. Ideally I'd not be making a core change.
ururk
 
Posts: 18
Joined: Mon Nov 01, 2010 12:31 pm

Re: Change number of checkbox columns

Postby ururk » Mon Jan 10, 2011 11:07 pm

I solved this problem:

Edit line 128 (or thereabouts) in this template file:

Dataface_Form_Section_Template.html

Original:
Code: Select all
{if $element.field.widget.columns}{assign var=cols value=$element.field.widget.columns}{else}{assign var=cols value=3}{/if}


Change to:
Code: Select all
{if $element.field.widget.columns}{assign var=cols value=$element.field.widget.columns}{else}{assign var=cols value=2}{/if}


This looks to be a global change, so it might not work out if you want to target specific elements (though I'm guessing SMARTY provides the ability to target specific columns through an if statement).
ururk
 
Posts: 18
Joined: Mon Nov 01, 2010 12:31 pm

Re: Change number of checkbox columns

Postby shannah » Fri Jan 14, 2011 12:59 pm

As you can tell from this snippet, another way to do this on a field by field basis would be to set the widget:columns directive in the fields.ini file:
Code: Select all
widget:columns=2
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Change number of checkbox columns

Postby ururk » Fri Jan 14, 2011 6:28 pm

shannah wrote:As you can tell from this snippet, another way to do this on a field by field basis would be to set the widget:columns directive in the fields.ini file:

Ah, I like that method much better. I've started to delve a bit into the templates, but have never used SMARTY before.
ururk
 
Posts: 18
Joined: Mon Nov 01, 2010 12:31 pm


Return to Xataface Developers

Who is online

Users browsing this forum: No registered users and 13 guests

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