You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Georg Ragaller <ta...@dev.ragaller.org> on 2021/04/08 16:12:41 UTC

GridPager Component with Boostrap4

Hello all,

I am just starting with Tapestry (5.7.1) and use the grid component.
Also, the application module is annotated with 
@ImportModule(Bootstrap4Module.class), as I want to use Bootstrap 4.x.

However, with this combination the links of the embedded pager component 
are not drawn in the expected Bootstrap 4 style.


In my opinion, this is because in 
org.apache.tapestry5.corelib.components.GridPager the render 
functionality does not distinguish between Bootstrap 3 and 4.

As far as I can see, the pagination component in Bootstrap 4 needs 
additional CSS classes compared to version 3, namely 'page-item' and 
'page-link'.

See:

https://getbootstrap.com/docs/3.4/components/#pagination
https://getbootstrap.com/docs/4.3/components/pagination/

So is the current behaviour a bug, or am I still doing something wrong?

Cheers,
Georg


P.S.: For me, I have solved the problem for the time being with the 
enclosed patch.


Re: GridPager Component with Boostrap4

Posted by Georg Ragaller <ta...@dev.ragaller.org>.
Hello Thiago,

thanks for the detailed answer and the suggestion with the alternative 
workaround.

Georg


Am 13.04.2021 um 13:59 schrieb Thiago H. de Paula Figueiredo:
> On Thu, Apr 8, 2021 at 1:12 PM Georg Ragaller <ta...@dev.ragaller.org>
> wrote:
> 
>> Hello all,
>>
> 
> Hello, Georg!
> 
> 
>> I am just starting with Tapestry (5.7.1) and use the grid component.
>>
> 
> Welcome to the Tapestry community!
> 
> 
>> Also, the application module is annotated with
>> @ImportModule(Bootstrap4Module.class), as I want to use Bootstrap 4.x.
>> However, with this combination the links of the embedded pager component
>> are not drawn in the expected Bootstrap 4 style.
>> In my opinion, this is because in
>> org.apache.tapestry5.corelib.components.GridPager the render
>> functionality does not distinguish between Bootstrap 3 and 4.
>> As far as I can see, the pagination component in Bootstrap 4 needs
>> additional CSS classes compared to version 3, namely 'page-item' and
>> 'page-link'.
>>
>> See:
>>
>> https://getbootstrap.com/docs/3.4/components/#pagination
>> https://getbootstrap.com/docs/4.3/components/pagination/
>>
>> So is the current behaviour a bug, or am I still doing something wrong?
>>
> 
> It's a bug and thanks for reporting it. Unluckily, we cut 5.7.2 and 5.6.4
> last Thursday, otherwise your very well written patch would have been
> applied already. Thanks for the patch!
> 
> Meanwhile, you can fix this without touching Tapestry's sources in at least
> 4 different ways, and I'll really explain just one for now for time reasons:
> 1) Easier one: copy the Grid Java source file, rename it to something like
> FixedGrid, then tell Tapestry to use FixedGrid anytime you use Grid by
> adding this method to AppModule (not tested):
> public static void contributeServiceOverride(MappedConfiguration<Class,
> Class> configuration) {
>      configuration.add(Grid.class, FixedGrid.class);
> }
> 2) Create a mixin to add the missing CSS classes through DOM rewriting and
> apply it manually to your Grid instances through t:mixins
> 3) Create a mixin to add the missing CSS classes through DOM rewriting and
> apply it automatically by adding a new component class transformer.
> 4) Create a GridWrapper class that passes all the parameters it gets to
> Grid, then uses DOM rewriting to add the missing CSS classes.
> 
> Tapestry is very, very flexible and composable, which explains the variety
> of ways you can use to solve your problem. :)
> 
> 
>>
>> Cheers,
>> Georg
>>
>>
>> P.S.: For me, I have solved the problem for the time being with the
>> enclosed patch.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: GridPager Component with Boostrap4

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, Apr 8, 2021 at 1:12 PM Georg Ragaller <ta...@dev.ragaller.org>
wrote:

> Hello all,
>

Hello, Georg!


> I am just starting with Tapestry (5.7.1) and use the grid component.
>

Welcome to the Tapestry community!


> Also, the application module is annotated with
> @ImportModule(Bootstrap4Module.class), as I want to use Bootstrap 4.x.
> However, with this combination the links of the embedded pager component
> are not drawn in the expected Bootstrap 4 style.
> In my opinion, this is because in
> org.apache.tapestry5.corelib.components.GridPager the render
> functionality does not distinguish between Bootstrap 3 and 4.
> As far as I can see, the pagination component in Bootstrap 4 needs
> additional CSS classes compared to version 3, namely 'page-item' and
> 'page-link'.
>
> See:
>
> https://getbootstrap.com/docs/3.4/components/#pagination
> https://getbootstrap.com/docs/4.3/components/pagination/
>
> So is the current behaviour a bug, or am I still doing something wrong?
>

It's a bug and thanks for reporting it. Unluckily, we cut 5.7.2 and 5.6.4
last Thursday, otherwise your very well written patch would have been
applied already. Thanks for the patch!

Meanwhile, you can fix this without touching Tapestry's sources in at least
4 different ways, and I'll really explain just one for now for time reasons:
1) Easier one: copy the Grid Java source file, rename it to something like
FixedGrid, then tell Tapestry to use FixedGrid anytime you use Grid by
adding this method to AppModule (not tested):
public static void contributeServiceOverride(MappedConfiguration<Class,
Class> configuration) {
    configuration.add(Grid.class, FixedGrid.class);
}
2) Create a mixin to add the missing CSS classes through DOM rewriting and
apply it manually to your Grid instances through t:mixins
3) Create a mixin to add the missing CSS classes through DOM rewriting and
apply it automatically by adding a new component class transformer.
4) Create a GridWrapper class that passes all the parameters it gets to
Grid, then uses DOM rewriting to add the missing CSS classes.

Tapestry is very, very flexible and composable, which explains the variety
of ways you can use to solve your problem. :)


>
> Cheers,
> Georg
>
>
> P.S.: For me, I have solved the problem for the time being with the
> enclosed patch.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org



-- 
Thiago