0

Hidden column appears when sorting (Grid)

asked 2020-01-11 01:53:13 +0800

pablo123 gravatar image pablo123
31 1

Hi! I have a problem that I cant resolve. The thing is that I have the menupopup = "auto"> set on <columns> and sort="auto(fecha) on <column> tag. When I hide a column using the menupopup it works fine, but if I wanna sort any column by clicking on it (as sort="auto") the hidden column appears again, it doesnt stay hidden. Any idea why does this hapen?

Also I need to be able to drag columns to change the order (obviously with the data in the rows) and get the sum of one specific column. What do I need to do that? Thanks for the help!

Here's my ZUL. (Im using a renderer for the grid)

<div apply="main.java.grid.dynamic_renderer.ClienteRenderController">
<grid id="grid" model="${$composer.clientes}"
    rowRenderer="main.java.grid.dynamic_renderer.ClienteRender"
    mold="paging" pageSize="10">
    <auxhead sclass="category-center">
       <auxheader colspan="6" rowspan="1">
            <image src="/img/logo.jpg" width="100%" height="220px" />
       </auxheader>
    </auxhead>
    <columns sizable="true" menupopup = "auto">
        <column onCreate="self.sort(true)" sort="auto(id)" tooltiptext="Ordenar" hflex="med" label="ID"/>   
        <column visible="true" sort="auto(cliente)" tooltiptext="Ordenar" hflex="med" label="Clientes"/>
        <column sort="auto(fecha)" tooltiptext="Ordenar" hflex="med" label="Fecha"/>
        <column sort="auto(importe)" tooltiptext="Ordenar" hflex="med" label="Importe"/>
        <column sort="auto(concepto)" tooltiptext="Ordenar" hflex="med" label="Concepto"/>
        <column sort="auto(metodo_pago)" tooltiptext="Ordenar" hflex="med" label="Método de pago"/>
    </columns>      
</grid>

delete flag offensive retag edit

Comments

for hidden column issue, I can't reproduce it locally. Could you provide an example? You can replace your data by ListModelList model = new ListModelList(Locale.getAvailableLocales())

hawk ( 2020-01-17 11:32:22 +0800 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2020-01-13 10:26:23 +0800

hawk gravatar image hawk
2550 1 5
http://hawkphoenix.blogsp... ZK Team

hidden columns appear again

there is a bug (https://tracker.zkoss.org/browse/ZK-1816) which looks the same to your case, but it's fixed in 7.0.6. Which version do you use?

drag to change columns order

There is no such built-in features in Grid. You need to implement such behavior by yourself. The overall steps are:

  1. make you columns draggable and droppable e.g. <column draggable="true" droppable="true">
  2. listen to onDrop event and implement your business logic. In your onDrop listener, you can pass the new column order to your RowRender and trigger it to re-render.

Please refer to https://www.zkoss.org/wiki/ZKDeveloper%27sReference/UIPatterns/Dragand_Drop

Sum of each column

There is no such built-in features in Grid. You need to sum each column based on your model by yourself. Then, show the sum in a footer.

link publish delete flag offensive edit

Comments

I'm using the latest version, zk 9. I'll take a look on what you said. Thank you!

pablo123 ( 2020-01-13 22:32:48 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2020-01-11 01:53:13 +0800

Seen: 9 times

Last updated: Jan 13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More