Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2660

Sync grid column visible state in client/server side when show/hide column through menupopup

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Normal Normal
    • 8.0.0
    • 7.0.4
    • ZK Client Engine
    • Security Level: Jean
    • None

      Sample:

      <zk>
      	<zscript><![CDATA[
      public class State {
      	private String id, code, name;
      
      	public State(String id, String code, String name) {
      		super();
      		this.id = id;
      		this.code = code;
      		this.name = name;
      	}
      	public String getId() {
      		return id;
      	}
      	public void setId(String id) {
      		this.id = id;
      	}
      	public String getCode() {
      		return code;
      	}
      	public void setCode(String code) {
      		this.code = code;
      	}
      	public String getName() {
      		return name;
      	}
      	public void setName(String name) {
      		this.name = name;
      	}
      }
      ListModelList statesListModel = new ListModelList();
      for (int i = 0; i < 10; i++) {
      	statesListModel.add(new State("id" + i, "code " + i, "name " + i));
      }
      	]]></zscript>
      	<window vflex="1">
      		<vlayout>
      			<label multiline="true">
      			1. Hide any column from the menupopup of listheader
      			2. Click "Show Listheader visibility", the visible state should sync with browser
      			</label>
      			<button label="Show Listheader visibility">
      				<attribute name="onClick"><![CDATA[
      					List headers = head.getChildren();
      					String message = "";
      					for (int i = 0, size = headers.size(); i < size; i++) {
      						Listheader header = headers.get(i);
      						message += "Column: " + header.getLabel() + ", Visible:" + header.isVisible() + "<br/>";
      					}
      					Clients.showNotification(message);
      				]]></attribute>
      			</button>
      			<listbox mold="paging" model="${statesListModel}" vflex="min">
      				<listhead id="head" menupopup="auto" columnshide="true">
      					<listheader width="40px" label="Id" />
      					<listheader width="150px" label="Code" />
      					<listheader width="150px" label="Name" />
      				</listhead>
      				<template name="model">
      					<listitem>
      						<listcell label="${each.id}" />
      						<listcell label="${each.code}" />
      						<listcell label="${each.name}" />
      					</listitem>
      				</template>
      			</listbox>
      		</vlayout>
      	</window>
      </zk>
      

            DevChu DevChu
            vincentjian vincentjian
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: