0

Span 3 columns in grid or listbox

asked 2022-05-09 15:33:29 +0800

softteam gravatar image softteam
130 8

Hi, I got a grid like this:

image description

<grid id="GridPrincipal" sclass="gridPrincipal" model="@init(vm.listaSeguimiento)" hflex="true" vflex="true" mold="paging" sizedByContent="true" emptyMessage="@load(vm.labelsSts.getLabel('noDatos'))" autopaging ="true" style="min-width:min-content" span="3">
      <custom-attributes org.zkoss.zul.grid.autohidePaging="false"/>
      <custom-attributes org.zkoss.zul.grid.rod="true" scope="page"/>
      <columns menupopup="auto" sizable="true" >

  <column id="ColSelector" width="40px" label="Selector" sclass="hiddenSelector" iconSclass="z-icon-info" />
  <column id="ColId" label="_id" tooltiptext="id" sort="auto(idDocumento)" hflex="min" sclass="hiddenbutton"/>
  <column id="ColFechaAlta" label="_Fecha alta"  sort="auto(fechaAlta)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColSolicitante" label="_Solicitante" sort="auto(datosUsuario)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColDocumentos" label="_Documentos" sort="auto(ruta)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColFirmas" label="_Firmas"  sort="auto(numFirmantes)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColEstado" label="_Estado" sort="auto(estado)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColEstadoLogico" label="_Estado Logico" sort="auto(estadoLogico)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColTipo" label="_Tipo" sort="auto(tipoDocumento)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColEtiqueta" label="_Etiqueta" sort="auto(etiqueta)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColArea" label="_Area" sort="auto(area)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColCentroExplotacion" label="_Centro Explotación" sort="auto(centroExplotacion)" hflex="min" sclass="hiddenbutton"/>
   <column id="ColNumPreguntas" label="_Num.Preg."  sort="auto(ratioPreguntas)" hflex="min" 
sclass="hiddenbutton"/>
</columns>
...
</grid>

I would like to know if there is any option to have at the sime time:

  • None column with width specified.
  • All columns but 3 with minimum width possible.
  • Span 3 remaining columns.

I do not want to span all columns but only 3 of them, in this case: "Solicitante", "Tipo documento", "Centro explotación".

Thank you,

Javier

delete flag offensive retag edit

2 Answers

Sort by » oldest newest most voted
0

answered 2022-05-13 17:10:17 +0800

MDuchemin gravatar image MDuchemin
2136 1 5
ZK Team

Hi Javier,

To clarify what you mean by "span the columns" in this context:

  • Usually, column span indicates that a cell will be displayed on more than one column For example, consider the columns A,B and C below:
    [ A ][ B ][ C ]
    [Cell1        ]
    [Cell2   ][c3 ]
    

In this example, cell1 is spanning 3 columns, cell2 is spanning 2 columns, and cell3 is spanning 1 column

Based on your screenshot, it looks like all of your cells already contain data, so I'm not sure that "cell spanning over multiple columns" is what you actually want to do.

Based on your description, do you mean you want to control column widths? If I understood correctly, I think you want all of your columns to be "as small as necessary to display their cells content", except 3 of them, which would share the rest of the available width? Is that correct?

If so, you can achieve this with column hflex, see sample here:

https://zkfiddle.org/sample/escug8/5-Grid-column-hflex

A column with hflex="min" will size down to the minimum necessary to display its cells' content. A column with hflex="1" (or other number) will share the remaining space with other columns with hflex values declared, by a proportion of the declared number.

link publish delete flag offensive edit
0

answered 2022-05-16 14:59:18 +0800

softteam gravatar image softteam
130 8

Hi,

This is exactly what I needed

Thank you!

Javier

link publish delete flag offensive 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
1 follower

RSS

Stats

Asked: 2022-05-09 15:33:29 +0800

Seen: 7 times

Last updated: May 16

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