Sorting columns on header click

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

Sorting columns on header click

Michael Imhof
I'm missing a functionality to sort a list by clicking on a column header.
I saw a few implementations using header-link=<url>?orderBy=<fieldname> but there's no generic
construct.

In our project I'm using such a generic construct. Internally of the ModelFormField class, I'm building
a hyper-link out of the name.
Now the only thing I have to do is setting the new attribute sort="true" and I got a header sorting mechanism.

Only restriction: It's sorting on database fields, so it's only working on database field columns.

I'm just wondering if there's a implementation planned for this subject
or if I should submit my changes to the JIRA. What do you think??

Regards,
Michael

Sample: Table with two rows Login/ Enabled. Sorting available on Login.
---------------------------------------------------------------------------------------
    <form name="ListLogin" type="list" list-name="listIt">
        <actions>
            <set field="entityName" value="UserLogin"/>
            <service service-name="performFind" result-map-name="result" result-map-list-name="listIt">
                <field-map field-name="inputFields" env-name="requestParameters"/>
                <field-map field-name="entityName" env-name="entityName"/>
            </service>
        </actions>
        <field name="userLoginId" title="Login" <b>sort="true">
            <display/>
        </field>
        <field name="enabled" title="Enabled">
            <display/>
        </field>
    </form>   

Reply | Threaded
Open this post in threaded view
|

Re: Sorting columns on header click

jonwimp
Hi Immi,

 > Only restriction: It's sorting on database fields, so it's only working on
 > database field columns.

What other columns would you like to sort by?

Sometimes, you might want to sort by a field that is external to the "findBy" request. Say your
SQL statement retrieves WorkEffort.currentStatusId and you want to sort by an external value say
in StatusType.description. You'll have to do a combined query (SQL joins), and then simply feed in
  "ORDER BY StatusType.description".

Or do you mean sorting outside of the database query?

I'm interested in this too. I've been beefing up the widget module, like you did. Looking for a
"header column sort UI" that doesn't use GET, but POST instead (to workaround possible problems
with characters incompatible with URL strings).

Jonathon

Immi wrote:

> I'm missing a functionality to sort a list by clicking on a column header.
> I saw a few implementations using header-link=<url>?orderBy=<fieldname> but
> there's no generic
> construct.
>
> In our project I'm using such a generic construct. Internally of the
> ModelFormField class, I'm building
> a hyper-link out of the name.
> Now the only thing I have to do is setting the new attribute sort="true" and
> I got a header sorting mechanism.
>
> Only restriction: It's sorting on database fields, so it's only working on
> database field columns.
>
> I'm just wondering if there's a implementation planned for this subject
> or if I should submit my changes to the JIRA. What do you think??
>
> Regards,
> Michael
>
> Sample: Table with two rows Login/ Enabled. Sorting available on Login.
> ---------------------------------------------------------------------------------------
>     <form name="ListLogin" type="list" list-name="listIt">
>         <actions>
>             <set field="entityName" value="UserLogin"/>
>             <service service-name="performFind" result-map-name="result"
> result-map-list-name="listIt">
>                 <field-map field-name="inputFields"
> env-name="requestParameters"/>
>                 <field-map field-name="entityName" env-name="entityName"/>
>             </service>
>         </actions>
>         <field name="userLoginId" title="Login" sort="true">
>             <display/>
>         </field>
>         <field name="enabled" title="Enabled">
>             <display/>
>         </field>
>     </form>  
>
> http://www.nabble.com/file/7851/list.jpg 

Reply | Threaded
Open this post in threaded view
|

Re: Sorting columns on header click

Michael Imhof
Hi Jonathon,

>What other columns would you like to sort by?
Well you don't have to display row database values. It's possible to convert them. For example, if
we're using multi language support, then the database value is just a key to a translated value.
But the sorting is working on the database value wich can be very confusing for a user..

>Sometimes, you might want to sort by a field that is external to the "findBy" request.
My solutions is KISS (Keep it simple stupid). I don't support such queries.

>Looking for a "header column sort UI" that doesn't use GET, but POST instead (to workaround
>possible problems with characters incompatible with URL strings).
I'm just using GET.

You see. I keep standing on the simple side.
But a small solution is better than no solution, isn't it:-)

Regards
Michael

jonwimp wrote
Hi Immi,

 > Only restriction: It's sorting on database fields, so it's only working on
 > database field columns.

What other columns would you like to sort by?

Sometimes, you might want to sort by a field that is external to the "findBy" request. Say your
SQL statement retrieves WorkEffort.currentStatusId and you want to sort by an external value say
in StatusType.description. You'll have to do a combined query (SQL joins), and then simply feed in
  "ORDER BY StatusType.description".

Or do you mean sorting outside of the database query?

I'm interested in this too. I've been beefing up the widget module, like you did. Looking for a
"header column sort UI" that doesn't use GET, but POST instead (to workaround possible problems
with characters incompatible with URL strings).

Jonathon

Immi wrote:
> I'm missing a functionality to sort a list by clicking on a column header.
> I saw a few implementations using header-link=<url>?orderBy=<fieldname> but
> there's no generic
> construct.
>
> In our project I'm using such a generic construct. Internally of the
> ModelFormField class, I'm building
> a hyper-link out of the name.
> Now the only thing I have to do is setting the new attribute sort="true" and
> I got a header sorting mechanism.
>
> Only restriction: It's sorting on database fields, so it's only working on
> database field columns.
>
> I'm just wondering if there's a implementation planned for this subject
> or if I should submit my changes to the JIRA. What do you think??
>
> Regards,
> Michael
>
> Sample: Table with two rows Login/ Enabled. Sorting available on Login.
> ---------------------------------------------------------------------------------------
>     <form name="ListLogin" type="list" list-name="listIt">
>         <actions>
>             <set field="entityName" value="UserLogin"/>
>             <service service-name="performFind" result-map-name="result"
> result-map-list-name="listIt">
>                 <field-map field-name="inputFields"
> env-name="requestParameters"/>
>                 <field-map field-name="entityName" env-name="entityName"/>
>             </service>
>         </actions>
>         <field name="userLoginId" title="Login" sort="true">
>             <display/>
>         </field>
>         <field name="enabled" title="Enabled">
>             <display/>
>         </field>
>     </form>   
>
> http://www.nabble.com/file/7851/list.jpg 
Reply | Threaded
Open this post in threaded view
|

Re: Sorting columns on header click

jonwimp
Michael,

So you got it sorting on non-database values? Javascript can handle that quick and cheap, right?

If that's what you're looking for, you can certainly do "generic constructs" that outputs
javascript functions just for that. I weaved in some javascript/ajax into the widget module. Is
that what you need? Or something else?

Jonathon

Michael Imhof wrote:

> Hi Jonathon,
>
>> What other columns would you like to sort by?
> Well you don't have to display row database values. It's possible to convert
> them. For example, if
> we're using multi language support, then the database value is just a key to
> a translated value.
> But the sorting is working on the database value wich can be very confusing
> for a user..
>
>> Sometimes, you might want to sort by a field that is external to the
> "findBy" request.
> My solutions is KISS (Keep it simple stupid). I don't support such queries.
>
>> Looking for a "header column sort UI" that doesn't use GET, but POST
> instead (to workaround
>> possible problems with characters incompatible with URL strings).
> I'm just using GET.
>
> You see. I keep standing on the simple side.
> But a small solution is better than no solution, isn't it:-)
>
> Regards
> Michael
>
>
> jonwimp wrote:
>> Hi Immi,
>>
>>  > Only restriction: It's sorting on database fields, so it's only working
>> on
>>  > database field columns.
>>
>> What other columns would you like to sort by?
>>
>> Sometimes, you might want to sort by a field that is external to the
>> "findBy" request. Say your
>> SQL statement retrieves WorkEffort.currentStatusId and you want to sort by
>> an external value say
>> in StatusType.description. You'll have to do a combined query (SQL joins),
>> and then simply feed in
>>   "ORDER BY StatusType.description".
>>
>> Or do you mean sorting outside of the database query?
>>
>> I'm interested in this too. I've been beefing up the widget module, like
>> you did. Looking for a
>> "header column sort UI" that doesn't use GET, but POST instead (to
>> workaround possible problems
>> with characters incompatible with URL strings).
>>
>> Jonathon
>>
>> Immi wrote:
>>> I'm missing a functionality to sort a list by clicking on a column
>>> header.
>>> I saw a few implementations using header-link=<url>?orderBy=<fieldname>
>>> but
>>> there's no generic
>>> construct.
>>>
>>> In our project I'm using such a generic construct. Internally of the
>>> ModelFormField class, I'm building
>>> a hyper-link out of the name.
>>> Now the only thing I have to do is setting the new attribute sort="true"
>>> and
>>> I got a header sorting mechanism.
>>>
>>> Only restriction: It's sorting on database fields, so it's only working
>>> on
>>> database field columns.
>>>
>>> I'm just wondering if there's a implementation planned for this subject
>>> or if I should submit my changes to the JIRA. What do you think??
>>>
>>> Regards,
>>> Michael
>>>
>>> Sample: Table with two rows Login/ Enabled. Sorting available on Login.
>>> ---------------------------------------------------------------------------------------
>>>     <form name="ListLogin" type="list" list-name="listIt">
>>>         <actions>
>>>             <set field="entityName" value="UserLogin"/>
>>>             <service service-name="performFind" result-map-name="result"
>>> result-map-list-name="listIt">
>>>                 <field-map field-name="inputFields"
>>> env-name="requestParameters"/>
>>>                 <field-map field-name="entityName"
>>> env-name="entityName"/>
>>>             </service>
>>>         </actions>
>>>         <field name="userLoginId" title="Login" sort="true">
>>>             <display/>
>>>         </field>
>>>         <field name="enabled" title="Enabled">
>>>             <display/>
>>>         </field>
>>>     </form>  
>>>
>>> http://www.nabble.com/file/7851/list.jpg 
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Sorting columns on header click

Michael Imhof
Yes, javascript could do this quick and cheap. But what happens with lists using pagination!!!
With javascript, we are just sorting the values of the current page instead of sorting overall.
And that's not what a user expects when he does sorting. For this reason we're using sorting
ONLY on database values....

My solution is adding a generic javascript to the titleHyperlink in the widget module.
I already use it in our project and it works fine.

I was just wondering if I should commit this to JIRA or not?

Michael

jonwimp wrote
Michael,

So you got it sorting on non-database values? Javascript can handle that quick and cheap, right?

If that's what you're looking for, you can certainly do "generic constructs" that outputs
javascript functions just for that. I weaved in some javascript/ajax into the widget module. Is
that what you need? Or something else?

Jonathon

Michael Imhof wrote:
> Hi Jonathon,
>
>> What other columns would you like to sort by?
> Well you don't have to display row database values. It's possible to convert
> them. For example, if
> we're using multi language support, then the database value is just a key to
> a translated value.
> But the sorting is working on the database value wich can be very confusing
> for a user..
>
>> Sometimes, you might want to sort by a field that is external to the
> "findBy" request.
> My solutions is KISS (Keep it simple stupid). I don't support such queries.
>
>> Looking for a "header column sort UI" that doesn't use GET, but POST
> instead (to workaround
>> possible problems with characters incompatible with URL strings).
> I'm just using GET.
>
> You see. I keep standing on the simple side.
> But a small solution is better than no solution, isn't it:-)
>
> Regards
> Michael
>
>
> jonwimp wrote:
>> Hi Immi,
>>
>>  > Only restriction: It's sorting on database fields, so it's only working
>> on
>>  > database field columns.
>>
>> What other columns would you like to sort by?
>>
>> Sometimes, you might want to sort by a field that is external to the
>> "findBy" request. Say your
>> SQL statement retrieves WorkEffort.currentStatusId and you want to sort by
>> an external value say
>> in StatusType.description. You'll have to do a combined query (SQL joins),
>> and then simply feed in
>>   "ORDER BY StatusType.description".
>>
>> Or do you mean sorting outside of the database query?
>>
>> I'm interested in this too. I've been beefing up the widget module, like
>> you did. Looking for a
>> "header column sort UI" that doesn't use GET, but POST instead (to
>> workaround possible problems
>> with characters incompatible with URL strings).
>>
>> Jonathon
>>
>> Immi wrote:
>>> I'm missing a functionality to sort a list by clicking on a column
>>> header.
>>> I saw a few implementations using header-link=<url>?orderBy=<fieldname>
>>> but
>>> there's no generic
>>> construct.
>>>
>>> In our project I'm using such a generic construct. Internally of the
>>> ModelFormField class, I'm building
>>> a hyper-link out of the name.
>>> Now the only thing I have to do is setting the new attribute sort="true"
>>> and
>>> I got a header sorting mechanism.
>>>
>>> Only restriction: It's sorting on database fields, so it's only working
>>> on
>>> database field columns.
>>>
>>> I'm just wondering if there's a implementation planned for this subject
>>> or if I should submit my changes to the JIRA. What do you think??
>>>
>>> Regards,
>>> Michael
>>>
>>> Sample: Table with two rows Login/ Enabled. Sorting available on Login.
>>> ---------------------------------------------------------------------------------------
>>>     <form name="ListLogin" type="list" list-name="listIt">
>>>         <actions>
>>>             <set field="entityName" value="UserLogin"/>
>>>             <service service-name="performFind" result-map-name="result"
>>> result-map-list-name="listIt">
>>>                 <field-map field-name="inputFields"
>>> env-name="requestParameters"/>
>>>                 <field-map field-name="entityName"
>>> env-name="entityName"/>
>>>             </service>
>>>         </actions>
>>>         <field name="userLoginId" title="Login" sort="true">
>>>             <display/>
>>>         </field>
>>>         <field name="enabled" title="Enabled">
>>>             <display/>
>>>         </field>
>>>     </form>   
>>>
>>> http://www.nabble.com/file/7851/list.jpg 
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Sorting columns on header click

cjhowe
Hi Michael,
LiveGrid Plus does this pretty well.  Services just need to be made to
handle the variables correctly.  

--- Michael Imhof <[hidden email]> wrote:

>
> Yes, javascript could do this quick and cheap. But what happens with
> lists
> using pagination!!!
> With javascript, we are just sorting the values of the current page
> instead
> of sorting overall.
> And that's not what a user expects when he does sorting. For this
> reason
> we're using sorting
> ONLY on database values....
>
> My solution is adding a generic javascript to the titleHyperlink in
> the
> widget module.
> I already use it in our project and it works fine.
>
> I was just wondering if I should commit this to JIRA or not?
>
> Michael
>
>
> jonwimp wrote:
> >
> > Michael,
> >
> > So you got it sorting on non-database values? Javascript can handle
> that
> > quick and cheap, right?
> >
> > If that's what you're looking for, you can certainly do "generic
> > constructs" that outputs
> > javascript functions just for that. I weaved in some
> javascript/ajax into
> > the widget module. Is
> > that what you need? Or something else?
> >
> > Jonathon
> >
> > Michael Imhof wrote:
> >> Hi Jonathon,
> >>
> >>> What other columns would you like to sort by?
> >> Well you don't have to display row database values. It's possible
> to
> >> convert
> >> them. For example, if
> >> we're using multi language support, then the database value is
> just a key
> >> to
> >> a translated value.
> >> But the sorting is working on the database value wich can be very
> >> confusing
> >> for a user..
> >>
> >>> Sometimes, you might want to sort by a field that is external to
> the
> >> "findBy" request.
> >> My solutions is KISS (Keep it simple stupid). I don't support such
> >> queries.
> >>
> >>> Looking for a "header column sort UI" that doesn't use GET, but
> POST
> >> instead (to workaround
> >>> possible problems with characters incompatible with URL strings).
> >> I'm just using GET.
> >>
> >> You see. I keep standing on the simple side.
> >> But a small solution is better than no solution, isn't it:-)
> >>
> >> Regards
> >> Michael
> >>
> >>
> >> jonwimp wrote:
> >>> Hi Immi,
> >>>
> >>>  > Only restriction: It's sorting on database fields, so it's
> only
> >>> working
> >>> on
> >>>  > database field columns.
> >>>
> >>> What other columns would you like to sort by?
> >>>
> >>> Sometimes, you might want to sort by a field that is external to
> the
> >>> "findBy" request. Say your
> >>> SQL statement retrieves WorkEffort.currentStatusId and you want
> to sort
> >>> by
> >>> an external value say
> >>> in StatusType.description. You'll have to do a combined query
> (SQL
> >>> joins),
> >>> and then simply feed in
> >>>   "ORDER BY StatusType.description".
> >>>
> >>> Or do you mean sorting outside of the database query?
> >>>
> >>> I'm interested in this too. I've been beefing up the widget
> module, like
> >>> you did. Looking for a
> >>> "header column sort UI" that doesn't use GET, but POST instead
> (to
> >>> workaround possible problems
> >>> with characters incompatible with URL strings).
> >>>
> >>> Jonathon
> >>>
> >>> Immi wrote:
> >>>> I'm missing a functionality to sort a list by clicking on a
> column
> >>>> header.
> >>>> I saw a few implementations using
> header-link=<url>?orderBy=<fieldname>
> >>>> but
> >>>> there's no generic
> >>>> construct.
> >>>>
> >>>> In our project I'm using such a generic construct. Internally of
> the
> >>>> ModelFormField class, I'm building
> >>>> a hyper-link out of the name.
> >>>> Now the only thing I have to do is setting the new attribute
> >>>> sort="true"
> >>>> and
> >>>> I got a header sorting mechanism.
> >>>>
> >>>> Only restriction: It's sorting on database fields, so it's only
> working
> >>>> on
> >>>> database field columns.
> >>>>
> >>>> I'm just wondering if there's a implementation planned for this
> subject
> >>>> or if I should submit my changes to the JIRA. What do you
> think??
> >>>>
> >>>> Regards,
> >>>> Michael
> >>>>
> >>>> Sample: Table with two rows Login/ Enabled. Sorting available on
> Login.
> >>>>
>
---------------------------------------------------------------------------------------

> >>>>     <form name="ListLogin" type="list" list-name="listIt">
> >>>>         <actions>
> >>>>             <set field="entityName" value="UserLogin"/>
> >>>>             <service service-name="performFind"
> >>>> result-map-name="result"
> >>>> result-map-list-name="listIt">
> >>>>                 <field-map field-name="inputFields"
> >>>> env-name="requestParameters"/>
> >>>>                 <field-map field-name="entityName"
> >>>> env-name="entityName"/>
> >>>>             </service>
> >>>>         </actions>
> >>>>         <field name="userLoginId" title="Login" sort="true">
> >>>>             <display/>
> >>>>         </field>
> >>>>         <field name="enabled" title="Enabled">
> >>>>             <display/>
> >>>>         </field>
> >>>>     </form>  
> >>>>
> >>>> http://www.nabble.com/file/7851/list.jpg 
> >>>
> >>>
> >>
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Sorting-columns-on-header-click-tf3570354.html#a10032782
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.
>
>