Quantcast

How to set css-classes for <g:datePicker />

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to set css-classes for <g:datePicker />

Cos Costa
Hi list,

i was wondering if there is a way to set css classes for the tag <g:datePicker>.
Somthing like <g:datePicker class="myCssClass">  has no effect.

Any hint ?

thnx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to set css-classes for <g:datePicker />

lucastex
It is probably better to wrap it in other div or element and use hierarchical css rules to reach it.

[]s,
 



On Thu, Dec 29, 2011 at 9:25 AM, Cos Costa <[hidden email]> wrote:
Hi list,

i was wondering if there is a way to set css classes for the tag <g:datePicker>.
Somthing like <g:datePicker class="myCssClass">  has no effect.

Any hint ?

thnx

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to set css-classes for <g:datePicker />

David Trattnig
In reply to this post by Cos Costa
The datePicker is a Grails Tag which renders various HTML elements and which can be styled individually (not just by one css-class). The easiest approach is to select the element to be styled with Firebug. In case it has a css-class assigned you can use this one. Otherwise you have to select it relatively using one of the parent elements.

HTH
david


On Thu, Dec 29, 2011 at 12:25 PM, Cos Costa <[hidden email]> wrote:
Hi list,

i was wondering if there is a way to set css classes for the tag <g:datePicker>.
Somthing like <g:datePicker class="myCssClass">  has no effect.

Any hint ?

thnx

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to set css-classes for <g:datePicker />

Cos Costa
thnx guys, I guess I got to swallow that one ... to bad

2011/12/29 David Trattnig <[hidden email]>
The datePicker is a Grails Tag which renders various HTML elements and which can be styled individually (not just by one css-class). The easiest approach is to select the element to be styled with Firebug. In case it has a css-class assigned you can use this one. Otherwise you have to select it relatively using one of the parent elements.

HTH
david



On Thu, Dec 29, 2011 at 12:25 PM, Cos Costa <[hidden email]> wrote:
Hi list,

i was wondering if there is a way to set css classes for the tag <g:datePicker>.
Somthing like <g:datePicker class="myCssClass">  has no effect.

Any hint ?

thnx


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to set css-classes for <g:datePicker />

Igor Sinev
You might help my approach helpful. I just finished restyling
datePicker for twitter bootstrap. To do it, I wrote a custom tag:
def customDatePicker = {attrs, body ->        def unstyled =
g.datePicker(attrs, body)        def sizes = [day: 2, month: 2, year:
2]        def styled =
unstyled.replaceAll('name="dueDate_(day|month|year)"') { match,
timeUnit ->            "${match} class=\"span${sizes[timeUnit]}\""
   }        out << styled    }
On Thu, Dec 29, 2011 at 9:43 PM, Cos Costa <[hidden email]> wrote:

> thnx guys, I guess I got to swallow that one ... to bad
>
>
> 2011/12/29 David Trattnig <[hidden email]>
>>
>> The datePicker is a Grails Tag which renders various HTML elements and
>> which can be styled individually (not just by one css-class). The easiest
>> approach is to select the element to be styled with Firebug. In case it has
>> a css-class assigned you can use this one. Otherwise you have to select it
>> relatively using one of the parent elements.
>>
>> HTH
>> david
>>
>>
>>
>> On Thu, Dec 29, 2011 at 12:25 PM, Cos Costa <[hidden email]> wrote:
>>>
>>> Hi list,
>>>
>>> i was wondering if there is a way to set css classes for the tag
>>> <g:datePicker>.
>>> Somthing like <g:datePicker class="myCssClass">  has no effect.
>>>
>>> Any hint ?
>>>
>>> thnx
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to set css-classes for <g:datePicker />

Konstantinos Kostarellis
I guess that should rather look like:

def customDatePicker = {attrs, body ->        
def unstyled = g.datePicker(attrs, body)        
def sizes = [day: 1, month: 2, year:1]        
def styled = unstyled.replaceAll('name="\\S+_(day|month|year)"') { match, timeUnit -> 
println match           
"${match} class=\"span${sizes[timeUnit]}\""
  }       
out << styled    
}

Else-ways it would be bound to the fieldname "dueDate"

another approach could be a CSS with something like:
select[id*='_day'] { width:100px;}
select[id*='_month'] { width:100px;}
select[id*='_year'] { width:100px;}

(replace the the px values with what you would like it to be)

Cheers,
   Kosta

2011/12/30 Igor Sinev <[hidden email]>
You might help my approach helpful. I just finished restyling
datePicker for twitter bootstrap. To do it, I wrote a custom tag:
def customDatePicker = {attrs, body ->        def unstyled =
g.datePicker(attrs, body)        def sizes = [day: 2, month: 2, year:
2]        def styled =
unstyled.replaceAll('name="dueDate_(day|month|year)"') { match,
timeUnit ->            "${match} class=\"span${sizes[timeUnit]}\""
   }        out << styled    }
On Thu, Dec 29, 2011 at 9:43 PM, Cos Costa <[hidden email]> wrote:
> thnx guys, I guess I got to swallow that one ... to bad
>
>
> 2011/12/29 David Trattnig <[hidden email]>
>>
>> The datePicker is a Grails Tag which renders various HTML elements and
>> which can be styled individually (not just by one css-class). The easiest
>> approach is to select the element to be styled with Firebug. In case it has
>> a css-class assigned you can use this one. Otherwise you have to select it
>> relatively using one of the parent elements.
>>
>> HTH
>> david
>>
>>
>>
>> On Thu, Dec 29, 2011 at 12:25 PM, Cos Costa <[hidden email]> wrote:
>>>
>>> Hi list,
>>>
>>> i was wondering if there is a way to set css classes for the tag
>>> <g:datePicker>.
>>> Somthing like <g:datePicker class="myCssClass">  has no effect.
>>>
>>> Any hint ?
>>>
>>> thnx
>>
>>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Loading...