xiaochong / zkui

Grails ZK UI Plugin
http://grails.org/plugin/zkui
GNU Lesser General Public License v3.0
24 stars 8 forks source link

Table header Sorting #43

Open kubicekmartin opened 12 years ago

kubicekmartin commented 12 years ago

Hello,

Thanks for this great plugin. Really good work.

I have got one question to header sorting in table. I defined autosorting in view, but if I click on second column header, data in table are still sorted according id.

What am I doing wrong? Could you please provide me some example.

Thank you very much for your help.

        <z:grid id="grid" emptyMessage="${message(code:'emptyMessage',default:'No Record')}" >
            <z:columns sizable="true">
                <z:column id="nazov" label="${message(code: 'klient.nazov.label', default: 'Názov')}" sort="auto"/>
                <z:column width="60px" sort="auto" label="${message(code: 'klient.bunka.label', default: 'Bunka')}" />
                <z:column label="${message(code: 'klient.stav.label', default: 'Stav')}" sort="auto(stav)" />
                <z:column label="${message(code: 'klient.odvetvie.label', default: 'Odvetvie')}" sort="auto" />
                <z:column sort="auto" label="${message(code: 'klient.adresa.label', default: 'Adresa')}"/>
                <z:column sort="auto" label="${message(code: 'klient.zodpovednaOsoba.label', default: 'Zodpovedná Osoba')}"/>
                <z:column width="150px"/>
            </z:columns>
        </z:grid>
        <z:paging autohide="true" id="paging" pageSize="50"/>
xiaochong commented 12 years ago

I test it ues sort="auto",it work fine.

kubicekmartin commented 12 years ago

Sorry, but don't. I have created small example application in jidea with just one table and three colums id and one string type and one int type. As database backend is used javaDB. After click on header table is sorted but still according id not according column. If I don't use database and manually define grid with values it's working.

I really desperate, I don't know what's wrong.

velo6raptor commented 11 years ago

When i put sort="auto" on the column grid, the sort doesn't work correctly I tried to use Comparator with sortAscending="${asc}" sortDescending="${dsc}" as in ZK doc with def asc = new ListitemComparator(-1, true, true) def dsc = new ListitemComparator(-1, false, true) in the Composer but it doesn't work too ! Could you give us the way to sort a column grid, it's urgent ! I really desperate too, I don't know what's wrong. Thanks

jcelestin commented 11 years ago

The issue is in the redraw() function. By default the criteria order selects "id". We need a way to capture the on sort event an identify the columns. Do you think we can have this? this will be very helpful. Thank you!