Replace sort icon column in Tapestry grid

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Replace sort icon column in Tapestry grid

duymap
Hi everyone,

Is there anyway to replace sort icon in column headers of Tapestry grid.

Thanks,
Duy.

--
Chung Khánh Duy
Project Support Manager
Formos
Reply | Threaded
Open this post in threaded view
|

Re: Replace sort icon column in Tapestry grid

Chris Poulsen
Its plain css?


On Fri, Aug 1, 2014 at 6:33 AM, Chung Khanh Duy <[hidden email]
> wrote:

> Hi everyone,
>
> Is there anyway to replace sort icon in column headers of Tapestry grid.
>
> Thanks,
> Duy.
>
> --
> Chung Khánh Duy
> Project Support Manager
> Formos
>
Reply | Threaded
Open this post in threaded view
|

Re: Replace sort icon column in Tapestry grid

duymap
Hi Chris,

I don't think so, we have 3 kind of sorting icons such as descending,
ascending and null icon. So we can not replace by css.

Another thing, I tried with "configuration.add(ComponentParameterConstants.
GRIDCOLUMNS_ASCENDING_ASSET, "pathtofile");"

But the point here we could not pass path file here, the tapestry always
understands /tapestry5/corelib/pathtofile. Therefore, I could not replace
by own path file to point correct icon image.

Thanks,
Duy.


On Fri, Aug 1, 2014 at 1:28 PM, Chris Poulsen <[hidden email]>
wrote:

> Its plain css?
>
>
> On Fri, Aug 1, 2014 at 6:33 AM, Chung Khanh Duy <
> [hidden email]
> > wrote:
>
> > Hi everyone,
> >
> > Is there anyway to replace sort icon in column headers of Tapestry grid.
> >
> > Thanks,
> > Duy.
> >
> > --
> > Chung Khánh Duy
> > Project Support Manager
> > Formos
> >
>



--
Chung Khánh Duy
Project Support Manager
Formos
Reply | Threaded
Open this post in threaded view
|

Re: Replace sort icon column in Tapestry grid

Chris Poulsen
There are different data attribute values on the <th> depending on which
sort you have.

Snippet from the GridColumns.java:

        if(!isSortDisabled()){
            switch (getSortForColumn())
            {
                case ASCENDING:
                    writer.attributes("data-grid-column-sort", "ascending");
                    break;

                case DESCENDING:
                    writer.attributes("data-grid-column-sort",
"descending");
                default:
                    writer.attributes("data-grid-column-sort", "sortable");
            }
        }

This allows you to do css selectors like:

th[data-grid-column-sort='ascending']

I'm sure you can handle all 3 cases with that trick.

--
Chris




On Fri, Aug 1, 2014 at 8:36 AM, Chung Khanh Duy <[hidden email]
> wrote:

> Hi Chris,
>
> I don't think so, we have 3 kind of sorting icons such as descending,
> ascending and null icon. So we can not replace by css.
>
> Another thing, I tried with "configuration.add(ComponentParameterConstants.
> GRIDCOLUMNS_ASCENDING_ASSET, "pathtofile");"
>
> But the point here we could not pass path file here, the tapestry always
> understands /tapestry5/corelib/pathtofile. Therefore, I could not replace
> by own path file to point correct icon image.
>
> Thanks,
> Duy.
>
>
> On Fri, Aug 1, 2014 at 1:28 PM, Chris Poulsen <[hidden email]>
> wrote:
>
> > Its plain css?
> >
> >
> > On Fri, Aug 1, 2014 at 6:33 AM, Chung Khanh Duy <
> > [hidden email]
> > > wrote:
> >
> > > Hi everyone,
> > >
> > > Is there anyway to replace sort icon in column headers of Tapestry
> grid.
> > >
> > > Thanks,
> > > Duy.
> > >
> > > --
> > > Chung Khánh Duy
> > > Project Support Manager
> > > Formos
> > >
> >
>
>
>
> --
> Chung Khánh Duy
> Project Support Manager
> Formos
>
Reply | Threaded
Open this post in threaded view
|

Re: Replace sort icon column in Tapestry grid

Chris Poulsen
Also if you want to create an asset from a path, you can use a combination
of @Inject and @Path to inject an Asset (or inject AssetSource and use that
to create the asset).


On Fri, Aug 1, 2014 at 9:33 AM, Chris Poulsen <[hidden email]>
wrote:

> There are different data attribute values on the <th> depending on which
> sort you have.
>
> Snippet from the GridColumns.java:
>
>         if(!isSortDisabled()){
>             switch (getSortForColumn())
>             {
>                 case ASCENDING:
>                     writer.attributes("data-grid-column-sort",
> "ascending");
>                     break;
>
>                 case DESCENDING:
>                     writer.attributes("data-grid-column-sort",
> "descending");
>                 default:
>                     writer.attributes("data-grid-column-sort", "sortable");
>             }
>         }
>
> This allows you to do css selectors like:
>
> th[data-grid-column-sort='ascending']
>
> I'm sure you can handle all 3 cases with that trick.
>
> --
> Chris
>
>
>
>
>
> On Fri, Aug 1, 2014 at 8:36 AM, Chung Khanh Duy <
> [hidden email]> wrote:
>
>> Hi Chris,
>>
>> I don't think so, we have 3 kind of sorting icons such as descending,
>> ascending and null icon. So we can not replace by css.
>>
>> Another thing, I tried with
>> "configuration.add(ComponentParameterConstants.
>> GRIDCOLUMNS_ASCENDING_ASSET, "pathtofile");"
>>
>> But the point here we could not pass path file here, the tapestry always
>> understands /tapestry5/corelib/pathtofile. Therefore, I could not replace
>> by own path file to point correct icon image.
>>
>> Thanks,
>> Duy.
>>
>>
>> On Fri, Aug 1, 2014 at 1:28 PM, Chris Poulsen <[hidden email]>
>> wrote:
>>
>> > Its plain css?
>> >
>> >
>> > On Fri, Aug 1, 2014 at 6:33 AM, Chung Khanh Duy <
>> > [hidden email]
>> > > wrote:
>> >
>> > > Hi everyone,
>> > >
>> > > Is there anyway to replace sort icon in column headers of Tapestry
>> grid.
>> > >
>> > > Thanks,
>> > > Duy.
>> > >
>> > > --
>> > > Chung Khánh Duy
>> > > Project Support Manager
>> > > Formos
>> > >
>> >
>>
>>
>>
>> --
>> Chung Khánh Duy
>> Project Support Manager
>> Formos
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Replace sort icon column in Tapestry grid

duymap
In reply to this post by Chris Poulsen
Hi Chris,

Thanks for your answer. It worked well :).

Duy.


On Fri, Aug 1, 2014 at 2:33 PM, Chris Poulsen <[hidden email]>
wrote:

> There are different data attribute values on the <th> depending on which
> sort you have.
>
> Snippet from the GridColumns.java:
>
>         if(!isSortDisabled()){
>             switch (getSortForColumn())
>             {
>                 case ASCENDING:
>                     writer.attributes("data-grid-column-sort",
> "ascending");
>                     break;
>
>                 case DESCENDING:
>                     writer.attributes("data-grid-column-sort",
> "descending");
>                 default:
>                     writer.attributes("data-grid-column-sort", "sortable");
>             }
>         }
>
> This allows you to do css selectors like:
>
> th[data-grid-column-sort='ascending']
>
> I'm sure you can handle all 3 cases with that trick.
>
> --
> Chris
>
>
>
>
> On Fri, Aug 1, 2014 at 8:36 AM, Chung Khanh Duy <
> [hidden email]
> > wrote:
>
> > Hi Chris,
> >
> > I don't think so, we have 3 kind of sorting icons such as descending,
> > ascending and null icon. So we can not replace by css.
> >
> > Another thing, I tried with
> "configuration.add(ComponentParameterConstants.
> > GRIDCOLUMNS_ASCENDING_ASSET, "pathtofile");"
> >
> > But the point here we could not pass path file here, the tapestry always
> > understands /tapestry5/corelib/pathtofile. Therefore, I could not replace
> > by own path file to point correct icon image.
> >
> > Thanks,
> > Duy.
> >
> >
> > On Fri, Aug 1, 2014 at 1:28 PM, Chris Poulsen <[hidden email]>
> > wrote:
> >
> > > Its plain css?
> > >
> > >
> > > On Fri, Aug 1, 2014 at 6:33 AM, Chung Khanh Duy <
> > > [hidden email]
> > > > wrote:
> > >
> > > > Hi everyone,
> > > >
> > > > Is there anyway to replace sort icon in column headers of Tapestry
> > grid.
> > > >
> > > > Thanks,
> > > > Duy.
> > > >
> > > > --
> > > > Chung Khánh Duy
> > > > Project Support Manager
> > > > Formos
> > > >
> > >
> >
> >
> >
> > --
> > Chung Khánh Duy
> > Project Support Manager
> > Formos
> >
>



--
Chung Khánh Duy
Project Support Manager
Formos