⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 z35-grid-0101.zul

📁 ZK是一个Ajax Java Web框架
💻 ZUL
字号:
<?xml version="1.0" encoding="UTF-8"?><!--Z35-grid-0102.zul{{IS_NOTE	Purpose:			Description:			History:		Tue May  6 09:29:59 TST 2008, Created by DennisChen}}IS_NOTECopyright (C) 2008 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT--><window title="Live Data Demo" border="normal">	Grouping with Live Data - Different Model should has different grouping		<zscript><![CDATA[//@DECLARATION	class RowLabelComparator implements Comparator {		boolean _asc;		public RowLabelComparator(boolean asc) {			_asc = asc;		}		public int compare(Object o1, Object o2) {			//Row row1 = (Row)o1;			//Row row2 = (Row)o2;			String s1 = (String)o1;//row1.getChildren().get(0).getValue();			String s2 = (String)o2;//row2.getChildren().get(0).getValue();			int v = s1.compareTo(s2);			return _asc ? v: -v;		}	}		class MyRowRenderer implements RowRenderer{		public void render(Row row, java.lang.Object data){			if(data instanceof String[]){				new Label(((String[])data)[0].toString()).setParent(row);			}else if (data instanceof String){				new Label(data.toString()).setParent(row);			}else{				new Label("UNKNOW:"+data.toString()).setParent(row);			}		}	}	MyRowRenderer renderer = new MyRowRenderer();	]]></zscript>		<zscript><![CDATA[  	                  	   			String[][] datas = new String[4][];		datas[0] = new String[15];		datas[1] = new String[19];		datas[2] = new String[27];		datas[3] = new String[33];		for(int j=0; j<datas[0].length; ++j) {			datas[0][j] = j+"A option "+j;		}		for(int j=0; j<datas[1].length; ++j) {			datas[1][j] = j+"B option "+j;		}		for(int j=0; j<datas[2].length; ++j) {			datas[2][j] = j+"C option "+j;		}		for(int j=0; j<datas[3].length; ++j) {			datas[3][j] = j+"D option "+j;		}		GroupsModel model1 = new SimpleGroupsModel(datas);		GroupsModel model2 = new SimpleGroupsModel(datas,new String[]{"Group A","Group B","Group C","Group D"});		GroupsModel model3 = new SimpleGroupsModel(datas,new String[]{"Group A","Group B","Group C","Group D"},new String[]{"Foot A","Foot B","Foot C","Foot D"});		GroupsModel model4 = new SimpleGroupsModel(datas,new String[]{"Group A","Group B","Group C","Group D"},new String[]{"Foot A1",null,"Footer C1",null});		GroupsModel model5 = new SimpleGroupsModel(datas,new String[]{"Group A","Group B","Group C","Group D"},new String[]{null,"Foot B2",null,"Footer D2"});						Comparator asc = new RowLabelComparator(true);		Comparator dsc = new RowLabelComparator(false);	]]></zscript>		<hbox>	<button onClick="gd1.setModel(model1);" label="data only"/>	<button onClick="gd1.setModel(model2)" label="data ,head"/>	<button onClick="gd1.setModel(model3)" label="data,head,foot"/>	<button onClick="gd1.setModel(model4)" label="not all foot"/>	<button onClick="gd1.setModel(model5)" label="not all foot 2"/>	<button onClick='if(gd1.mold.equals("default")){gd1.setMold("paging");gd1.setPageSize(7);}else{gd1.mold="default";}' label="set Paging"/>	<button onClick="gd1.invalidate();" label="invalidate"/> 	</hbox> 	<grid width="500px" height="500px" model="${model2}" id="gd1" rowRenderer="${renderer}">		<columns >			<column label="Load on Demend  (Grid)" sortAscending="${asc}" sortDescending="${dsc}"/>		</columns>	</grid>	</window>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -