View Javadoc
1   package gboat2.base.view.components;
2   
3   import javax.servlet.http.HttpServletRequest;
4   import javax.servlet.http.HttpServletResponse;
5   
6   import org.apache.commons.lang3.RandomStringUtils;
7   import org.apache.commons.lang3.StringUtils;
8   import org.apache.struts2.components.ClosingUIBean;
9   import org.apache.struts2.views.annotations.StrutsTag;
10  import org.apache.struts2.views.annotations.StrutsTagAttribute;
11  
12  import com.opensymphony.xwork2.util.ValueStack;
13  
14  /**
15   * <p>
16   * 根据返回的 JSON 数据,创建通用表格,详见:<br>
17   * http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options<br>;
18   * http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events
19   * </p>
20   * 示例代码:
21   * <pre>
22   * <code>
23   * &lt;g2:grid id="grid_role" caption="角色列表"&gt;
24   *     &lt;g2:remote href="role!list.do?data"/&gt;
25   *     &lt;g2:gridPager /&gt;
26   *     &lt;g2:gridColumn name="rownumberer" title="序号" formatter="rownumberer" width="45" fixed="true" /&gt;
27   *     &lt;g2:gridColumn name="roleId" title="ID" key="true" hidden="true"/&gt;
28   *     &lt;g2:gridColumn name="roleName" title="角色名称"/&gt;
29   *     &lt;g2:gridColumn name="roleCode" title="角色编码"/&gt;
30   *     &lt;g2:gridColumn name="description" title="描述"/&gt;
31   *     &lt;g2:gridOperations&gt;
32   *         &lt;g2:gridOperation name="edit"/&gt;
33   *         &lt;g2:gridOperation name="ajaxDelete"/&gt;
34   *         &lt;g2:gridOperation name="findResourceTree" title="权限管理" icon="icon-sitemap"/&gt;
35   *     &lt;/g2:gridOperations&gt;
36   * &lt;/g2:grid&gt;
37   * </code>
38   * </pre>
39   * @author <a href="mailto:[email protected]">何明旺</a>
40   * @since 3.0
41   * @date 2014年5月4日
42   * @see GridColumn
43   * @see GridOperations
44   * @see GridOperation
45   */
46  @StrutsTag(
47          name = "grid",
48          tldTagClass = "gboat2.base.view.jsp.GridTag",
49          description = "根据返回的 JSON 数据,创建通用表格,详见 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options,http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events",
50          allowDynamicAttributes=true)
51  public class Grid extends ClosingUIBean {
52  
53  	public static final String TEMPLATE = "grid";
54  	public static final String TEMPLATE_CLOSE = "grid-close";
55  	public static final String JQUERYACTION = "grid";
56  	public static final String COMPONENT_NAME = Grid.class.getName();
57  
58  	protected String width;
59  	protected String height;
60  	protected String sortname;
61  	protected String gridview;
62  	protected String autowidth;
63  	protected String sortorder;
64  	protected String loadonce;
65  	protected String multiselect;
66  	protected String multiboxonly;
67  	protected String editurl;
68  	protected String editinline;
69  	protected String caption;
70  	protected String shrinkToFit;
71  	protected String gridModel;
72  	protected String scroll;
73  	protected String navigator;
74  	protected String navigatorEditOptions;
75  	protected String navigatorAddOptions;
76  	protected String navigatorDeleteOptions;
77  	protected String navigatorSearchOptions;
78  	protected String navigatorViewOptions;
79  	protected String navigatorAdd;
80  	protected String navigatorDelete;
81  	protected String navigatorEdit;
82  	protected String navigatorRefresh;
83  	protected String navigatorSearch;
84  	protected String navigatorView;
85  	protected String navigatorInlineEditButtons;
86  	protected String navigatorExtraButtons;
87  	protected String navigatorCloneToTop;
88  	protected String autoencode;
89  	protected String cellEdit;
90  	protected String cellurl;
91  	protected String cellsubmit;
92  	protected String footerrow;
93  	protected String hiddengrid;
94  	protected String hidegrid;
95  	protected String hoverrows;
96  	protected String rownumbers;
97  	protected String multiselectWidth;
98  	protected String page;
99  	protected String scrollrows;
100 	protected String filter;
101 	protected String subGridWidth;
102 	protected String subGridUrl;
103 	protected String userDataOnFooter;
104 	protected String filterOptions;
105 	protected String altClass;
106 	protected String altRows;
107 	protected String prmNames;
108 	protected String direction;
109 	protected String rowTotal;
110 	protected String viewsortcols;
111 	protected String toppager;
112 
113 	protected String onSelectRowTopics;
114 	protected String onSelectAllTopics;
115 	protected String onSortColTopics;
116 	protected String onCellSelectTopics;
117 	protected String onGridCompleteTopics;
118 	protected String onEditInlineBeforeTopics;
119 	protected String onEditInlineSuccessTopics;
120 	protected String onEditInlineErrorTopics;
121 	protected String onEditInlineAfterSaveTopics;
122 	protected String onCellEditSuccessTopics;
123 	protected String onCellEditErrorTopics;
124 	protected String onSubGridRowExpanded;
125 	protected String onClickGroupTopics;
126 	protected String onDblClickRowTopics;
127 	protected String onRightClickRowTopics;
128 
129 	protected String reloadTopics;
130 
131     protected String sortableRows;
132     
133 	protected String connectWith;
134 
135 	protected String groupField;
136 	protected String groupColumnShow;
137 	protected String groupText;
138 	protected String groupCollapse;
139 	protected String groupOrder;
140 	protected String groupSummary;
141 	protected String groupDataSorted;
142 	protected String groupShowSummaryOnHide;
143 	protected String groupPlusIcon;
144 	protected String groupMinusIcon;
145 	
146 	protected String searchForm;
147 
148 	public Grid(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
149 		super(stack, request, response);
150 	}
151 
152 	@Override
153 	public String getDefaultOpenTemplate() {
154 		return TEMPLATE;
155 	}
156 
157 	@Override
158 	protected String getDefaultTemplate() {
159 		return TEMPLATE_CLOSE;
160 	}
161 
162 	@Override
163 	public void evaluateExtraParams() {
164 		super.evaluateExtraParams();
165 		
166 		addParameter("jqueryaction", JQUERYACTION);
167 
168 		Grid parentGrid = (Grid) findAncestor(Grid.class);
169 		if (parentGrid != null) { // 表格嵌套
170 			addParameter("subGrid", Boolean.TRUE);
171 			addParameter("parentGrid", findString(parentGrid.getId()));
172 			if (subGridUrl != null)
173 				addParameter("subGridUrl", findString(subGridUrl));
174 			if (subGridWidth != null)
175 				addParameter("subGridWidth", findValue(subGridWidth, Integer.class));
176 		}
177 		
178 		if (width != null)
179 			addParameter("width", findValue(width, Integer.class));
180 		
181 		if (height != null)
182 			addParameter("height", findValue(height, Integer.class));
183 
184 		if (sortname != null)
185 			addParameter("sortname", findString(sortname));
186 		
187 		if (autowidth != null)
188 			addParameter("autowidth", findValue(this.autowidth, Boolean.class));
189 		
190 		if (gridview != null)
191 			addParameter("gridview", findValue(this.gridview, Boolean.class));
192 		
193 		if (sortorder != null)
194 			addParameter("sortorder", findString(sortorder));
195 		
196 		if (loadonce != null)
197 			addParameter("loadonce", findValue(this.loadonce, Boolean.class));
198 		
199 		if (multiselect != null)
200 			addParameter("multiselect", findValue(this.multiselect, Boolean.class));
201 		
202 		if (multiboxonly != null)
203 			addParameter("multiboxonly", findValue(this.multiboxonly, Boolean.class));
204 		
205 		if (editurl != null)
206 			addParameter("editurl", findString(editurl));
207 		
208 		if (editinline != null)
209 			addParameter("editinline", findValue(this.editinline, Boolean.class));
210 		
211 		if (caption != null)
212 			addParameter("caption", findString(caption));
213 		
214 		if (shrinkToFit != null)
215 			addParameter("shrinkToFit", findValue(this.shrinkToFit, Boolean.class));
216 		
217 		if (gridModel != null)
218 			addParameter("gridModel", findString(gridModel));
219 		
220 		if (scroll != null)
221 			addParameter("scroll", findValue(scroll, Boolean.class));
222 		
223 		if (navigator != null)
224 			addParameter("navigator", findValue(this.navigator, Boolean.class));
225 		
226 		if (navigatorAddOptions != null)
227 			addParameter("navigatorAddOptions", findString(navigatorAddOptions));
228 		
229 		if (navigatorEditOptions != null)
230 			addParameter("navigatorEditOptions", findString(navigatorEditOptions));
231 		
232 		if (navigatorDeleteOptions != null)
233 			addParameter("navigatorDeleteOptions", findString(navigatorDeleteOptions));
234 		
235 		if (navigatorViewOptions != null)
236 			addParameter("navigatorViewOptions", findString(navigatorViewOptions));
237 		
238 		if (navigatorSearchOptions != null)
239 			addParameter("navigatorSearchOptions", findString(navigatorSearchOptions));
240 		
241 		if (navigatorAdd != null)
242 			addParameter("navigatorAdd", findValue(this.navigatorAdd, Boolean.class));
243 		
244 		if (navigatorDelete != null)
245 			addParameter("navigatorDelete", findValue(this.navigatorDelete, Boolean.class));
246 		
247 		if (navigatorEdit != null)
248 			addParameter("navigatorEdit", findValue(this.navigatorEdit, Boolean.class));
249 		
250 		if (navigatorRefresh != null)
251 			addParameter("navigatorRefresh", findValue(this.navigatorRefresh, Boolean.class));
252 		
253 		if (navigatorView != null)
254 			addParameter("navigatorView", findValue(this.navigatorView, Boolean.class));
255 		
256 		if (navigatorSearch != null)
257 			addParameter("navigatorSearch", findValue(this.navigatorSearch, Boolean.class));
258 		
259 		if (navigatorExtraButtons != null)
260 			addParameter("navigatorExtraButtons", findString(navigatorExtraButtons));
261 		
262 		if (navigatorInlineEditButtons != null)
263 			addParameter("navigatorInlineEditButtons", findValue(this.navigatorInlineEditButtons, Boolean.class));
264 		
265 		if (navigatorCloneToTop != null)
266 			addParameter("navigatorCloneToTop", findValue(this.navigatorCloneToTop, Boolean.class));
267 
268 		if (cellurl != null)
269 			addParameter("cellurl", findString(cellurl));
270 		
271 		if (cellsubmit != null)
272 		    addParameter("cellsubmit", findString(cellsubmit));
273 		
274 		if (multiselectWidth != null)
275 			addParameter("multiselectWidth", findValue(multiselectWidth, Integer.class));
276 		
277 		if (page != null)
278 			addParameter("page", findValue(page, Integer.class));
279 		
280 		if (autoencode != null)
281 			addParameter("autoencode", findValue(this.autoencode, Boolean.class));
282 		
283 		if (cellEdit != null)
284 			addParameter("cellEdit", findValue(this.cellEdit, Boolean.class));
285 		
286 		if (footerrow != null)
287 			addParameter("footerrow", findValue(this.footerrow, Boolean.class));
288 		
289 		if (hiddengrid != null)
290 			addParameter("hiddengrid", findValue(this.hiddengrid, Boolean.class));
291 		
292 		if (hidegrid != null)
293 			addParameter("hidegrid", findValue(this.hidegrid, Boolean.class));
294 		
295 		if (hoverrows != null)
296 			addParameter("hoverrows", findValue(this.hoverrows, Boolean.class));
297 		
298 		if (rownumbers != null)
299 			addParameter("rownumbers", findValue(this.rownumbers, Boolean.class));
300 		
301 		if (scrollrows != null)
302 			addParameter("scrollrows", findValue(this.scrollrows, Boolean.class));
303 		
304 		if (filter != null)
305 			addParameter("filter", findValue(this.filter, Boolean.class));
306 		
307 		if (filterOptions != null)
308 			addParameter("filterOptions", findString(filterOptions));
309 		
310 		if (userDataOnFooter != null)
311 			addParameter("userDataOnFooter", findValue(this.userDataOnFooter, Boolean.class));
312 		
313 		if (altClass != null)
314 			addParameter("altClass", findString(altClass));
315 		
316 		if (altRows != null)
317 			addParameter("altRows", findValue(this.altRows, Boolean.class));
318 		
319 		if (prmNames != null)
320 			addParameter("prmNames", findString(prmNames));
321 		
322 		if (direction != null)
323 			addParameter("direction", findString(direction));
324 		
325 		if (rowTotal != null)
326 			addParameter("rowTotal", findValue(this.rowTotal, Integer.class));
327 		
328 		if (viewsortcols != null)
329 			addParameter("viewsortcols", findString(viewsortcols));
330 		
331 		if (toppager != null)
332 			addParameter("toppager", findValue(this.toppager, Boolean.class));
333 
334 		if (onSelectRowTopics != null)
335 			addParameter("onSelectRowTopics", findString(onSelectRowTopics));
336 		
337 		if (onSelectAllTopics != null)
338 			addParameter("onSelectAllTopics", findString(onSelectAllTopics));
339 		
340 		if (onCellSelectTopics != null)
341 			addParameter("onCellSelectTopics", findString(onCellSelectTopics));
342 		
343 		if (onSortColTopics != null)
344 			addParameter("onSortColTopics", findString(onSortColTopics));
345 		
346 		if (onGridCompleteTopics != null)
347 			addParameter("onGridCompleteTopics", findString(onGridCompleteTopics));
348 		
349 		if (onEditInlineAfterSaveTopics != null)
350 			addParameter("onEditInlineAfterSaveTopics", findString(onEditInlineAfterSaveTopics));
351 		
352 		if (onEditInlineBeforeTopics != null)
353 			addParameter("onEditInlineBeforeTopics", findString(onEditInlineBeforeTopics));
354 		
355 		if (onEditInlineErrorTopics != null)
356 			addParameter("onEditInlineErrorTopics", findString(onEditInlineErrorTopics));
357 		
358 		if (onEditInlineSuccessTopics != null)
359 			addParameter("onEditInlineSuccessTopics", findString(onEditInlineSuccessTopics));
360 		
361 		if (onCellEditErrorTopics != null)
362 			addParameter("onCellEditErrorTopics", findString(onCellEditErrorTopics));
363 		
364 		if (onCellEditSuccessTopics != null)
365 			addParameter("onCellEditSuccessTopics", findString(onCellEditSuccessTopics));
366 		
367 		if (onSubGridRowExpanded != null)
368 			addParameter("onSubGridRowExpanded", findString(onSubGridRowExpanded));
369 		
370 		if (onClickGroupTopics != null)
371 			addParameter("onClickGroupTopics", findString(onClickGroupTopics));
372 		
373 		if (onDblClickRowTopics != null)
374 			addParameter("onDblClickRowTopics", findString(onDblClickRowTopics));
375 		
376 		if (onRightClickRowTopics != null)
377 			addParameter("onRightClickRowTopics", findString(onRightClickRowTopics));
378 		
379 		if (reloadTopics != null)
380 			addParameter("reloadTopics", findString(reloadTopics));
381 
382 		if (connectWith != null)
383 			addParameter("connectWith", findString(connectWith));
384 
385 		if (groupField != null)
386 			addParameter("groupField", findString(groupField));
387 		
388 		if (groupColumnShow != null)
389 			addParameter("groupColumnShow", findString(groupColumnShow));
390 		
391 		if (groupText != null)
392 			addParameter("groupText", findString(groupText));
393 		
394 		if (groupOrder != null)
395 			addParameter("groupOrder", findString(groupOrder));
396 		
397 		if (groupSummary != null)
398 			addParameter("groupSummary", findString(groupSummary));
399 		
400 		if (groupShowSummaryOnHide != null)
401 			addParameter("groupShowSummaryOnHide", findString(groupShowSummaryOnHide));
402 		
403 		if (groupPlusIcon != null)
404 			addParameter("groupPlusIcon", findString(groupPlusIcon));
405 		
406 		if (groupMinusIcon != null)
407 			addParameter("groupMinusIcon", findString(groupMinusIcon));
408 		
409 		if (groupDataSorted != null)
410 			addParameter("groupDataSorted", findValue(this.groupDataSorted, Boolean.class));
411 		
412 		if (groupCollapse != null)
413 			addParameter("groupCollapse", findValue(this.groupCollapse, Boolean.class));
414 		
415 		if (sortableRows != null && "true".equalsIgnoreCase(findString(sortableRows))) {
416 		    addParameter("sortableRows", Boolean.TRUE);
417 		}
418 		
419 		if (searchForm != null) {
420 			addParameter("searchForm", findString(searchForm));
421 		}
422 
423 		// 如果 ID 为空,则生成一个随机 ID
424 		if (StringUtils.isBlank(id)) {
425 			id = "grid_" + RandomStringUtils.randomNumeric(3);
426 			addParameter("id", id);
427 		}
428 	}
429 
430 	@StrutsTagAttribute(description = "如果设置则按此设置为主,如果没有设置则按colModel中定义的宽度计算", type="Integer")
431 	public void setWidth(String width) {
432 		this.width = width;
433 	}
434 
435 	@StrutsTagAttribute(description = "表格高度,单位为像素", defaultValue="150")
436 	public void setHeight(String height) {
437 		this.height = height;
438 	}
439 
440 	@StrutsTagAttribute(description = "默认的排序列。可以是 colModel 的列名称或者是一个数字,这个参数会被提交到后台")
441 	public void setSortname(String sortname) {
442 		this.sortname = sortname;
443 	}
444 
445 	@StrutsTagAttribute(description = "是否在构造一行数据后立即添加到grid中,如果设为true则是将整个表格的数据都构造完成后再添加到grid中,但treeGrid, subGrid, or afterInsertRow 不能用", defaultValue = "false", type = "Boolean")
446 	public void setGridview(String gridview) {
447 		this.gridview = gridview;
448 	}
449 
450 	@StrutsTagAttribute(description = "如果为ture时,则当表格在首次被创建时会根据父元素比例重新调整表格宽度。", defaultValue = "true", type = "Boolean")
451 	public void setAutowidth(String autowidth) {
452 		this.autowidth = autowidth;
453 	}
454 
455 	@StrutsTagAttribute(description = "排序顺序,可选值:asc - 升序 ,desc - 降序", defaultValue = "asc")
456 	public void setSortorder(String sortorder) {
457 		this.sortorder = sortorder;
458 	}
459 
460 	@StrutsTagAttribute(description = "如果为 ture,则数据只从服务器端获取一次,之后所有操作都是在客户端执行,翻页功能会被禁用", defaultValue = "false", type = "Boolean")
461 	public void setLoadonce(String loadonce) {
462 		this.loadonce = loadonce;
463 	}
464 
465 	@StrutsTagAttribute(description = "是否可以多选", defaultValue = "false", type = "Boolean")
466 	public void setMultiselect(String multiselect) {
467 		this.multiselect = multiselect;
468 	}
469 
470 	@StrutsTagAttribute(description = "设为 ture 时只有选择 checkbox 才会选择多行。只有当 multiselect=true 时才生效", defaultValue = "false", type = "Boolean")
471 	public void setMultiboxonly(String multiboxonly) {
472 		this.multiboxonly = multiboxonly;
473 	}
474 
475 	@StrutsTagAttribute(description = "编辑完某条数据后,点击“保存”时提交 Ajax 请求的 URL")
476 	public void setEditurl(String editurl) {
477 		this.editurl = editurl;
478 	}
479 
480 	@StrutsTagAttribute(description = "是否允许在行内编辑", defaultValue = "false", type = "Boolean")
481 	public void setEditinline(String editinline) {
482 		this.editinline = editinline;
483 	}
484 
485 	@StrutsTagAttribute(description = "表格名称")
486 	public void setCaption(String caption) {
487 		this.caption = caption;
488 	}
489 
490 	@StrutsTagAttribute(description = "用来说明当初始化列宽度时候的计算类型,如果为ture,则按比例初始化列宽度。如果为false,则列宽度使用 colModel 指定的宽度", type = "Boolean", defaultValue = "true")
491 	public void setShrinkToFit(String shrinkToFit) {
492 		this.shrinkToFit = shrinkToFit;
493 	}
494 
495 	@StrutsTagAttribute(description = "后台返回的 JSON 数据中指向真正的数据模型集合的 key,对应 jqGrid 组件 options 参数的 jsonReader.root 属性", defaultValue="data")
496 	public void setGridModel(String gridModel) {
497 		this.gridModel = gridModel;
498 	}
499 
500 	@StrutsTagAttribute(description = "创建一个动态滚动的表格,当为true时,翻页栏被禁用,使用垂直滚动条加载数据,且在首次访问服务器端时将加载所有数据到客户端。当此参数为数字时,表格只控制可见的几行,所有数据都在这几行中加载", type = "Boolean", defaultValue = "false")
501 	public void setScroll(String scroll) {
502 		this.scroll = scroll;
503 	}
504 
505 	@StrutsTagAttribute(description = "是否显示表格左下角的“新增”、删除等按钮的导航条,true|false.", defaultValue = "false", type = "Boolean")
506 	public void setNavigator(String navigator) {
507 		this.navigator = navigator;
508 	}
509 
510     @StrutsTagAttribute(description = "“新增”按钮操作的选项。如:{height:280,reloadAfterSubmit:false},")
511     public void setNavigatorAddOptions(String navigatorAddOptions) {
512         this.navigatorAddOptions = navigatorAddOptions;
513     }
514 
515 	@StrutsTagAttribute(description = "“编辑”按钮操作的选项。如: {height:280,reloadAfterSubmit:false},")
516 	public void setNavigatorEditOptions(String navigatorEditOptions) {
517 		this.navigatorEditOptions = navigatorEditOptions;
518 	}
519 
520 	@StrutsTagAttribute(description = "“删除”按钮操作的选项。如:{height:280,reloadAfterSubmit:false},")
521 	public void setNavigatorDeleteOptions(String navigatorDeleteOptions) {
522 		this.navigatorDeleteOptions = navigatorDeleteOptions;
523 	}
524 
525 	@StrutsTagAttribute(description = "“查找”按钮操作的选项。如:{height:280,reloadAfterSubmit:false},")
526 	public void setNavigatorSearchOptions(String navigatorSearchOptions) {
527 		this.navigatorSearchOptions = navigatorSearchOptions;
528 	}
529 
530 	@StrutsTagAttribute(description = "“查看”按钮操作的选项。如:{sopt:['cn','bw','eq','ne','lt','gt','ew']},")
531 	public void setNavigatorViewOptions(String navigatorViewOptions) {
532 		this.navigatorViewOptions = navigatorViewOptions;
533 	}
534 
535 	@StrutsTagAttribute(description = "是否将表格底部分页栏中的“新增”、删除等按钮的导航条复制到表格顶部的分布栏中(只有 toppager=true 时才生效)", defaultValue = "false", type = "Boolean")
536 	public void setNavigatorCloneToTop(String navigatorCloneToTop) {
537 	    this.navigatorCloneToTop = navigatorCloneToTop;
538 	}
539 
540 	@StrutsTagAttribute(description = "是否对 url 进行编码,值为 true 时,会将 url 中的特殊字符符进行编码处理,如:小于号将被转义为 &lt;", defaultValue = "true", type = "Boolean")
541 	public void setAutoencode(String autoencode) {
542 		this.autoencode = autoencode;
543 	}
544 
545 	@StrutsTagAttribute(description = "是否启用单元格编辑功能", defaultValue = "false", type = "Boolean")
546 	public void setCellEdit(String cellEdit) {
547 		this.cellEdit = cellEdit;
548 	}
549 
550 	@StrutsTagAttribute(description = "保存单元格数据时,提交的 ajax 请求的 url")
551 	public void setCellurl(String cellurl) {
552 		this.cellurl = cellurl;
553 	}
554 
555 	@StrutsTagAttribute(description = "编辑单元格后,数据提交的目标位置,可选值:remote - 单元格内容改变后将启动ajax请求cellurl配置的地址保存到服务器上; clientArray - 不会发送ajax请求,修改后内容可以条用getChangedCells方法或者通过事件获取到")
556     public void setCellsubmit(String cellsubmit) {
557         this.cellsubmit = cellsubmit;
558     }
559 
560     @StrutsTagAttribute(description = "当为true时,会在翻页栏之上增加一行", defaultValue = "false", type = "Boolean")
561 	public void setFooterrow(String footerrow) {
562 		this.footerrow = footerrow;
563 	}
564 
565 	@StrutsTagAttribute(description = "当为ture时,表格不会被显示,只显示表格的标题。只有当点击显示表格的那个按钮时才会去初始化表格数据。", defaultValue = "false", type = "Boolean")
566 	public void setHiddengrid(String hiddengrid) {
567 		this.hiddengrid = hiddengrid;
568 	}
569 
570 	@StrutsTagAttribute(description = "是否显示控制表格显示、隐藏的按钮,只有当caption 属性不为空时起效。", defaultValue = "false", type = "Boolean")
571 	public void setHidegrid(String hidegrid) {
572 		this.hidegrid = hidegrid;
573 	}
574 
575 	@StrutsTagAttribute(description = "当值为 false 时 mouse hovering 会被禁用。", defaultValue = "false", type = "Boolean")
576 	public void setHoverrows(String hoverrows) {
577 		this.hoverrows = hoverrows;
578 	}
579 
580 	@StrutsTagAttribute(description = "如果为 ture 则会在表格左边新增一列,显示行顺序号,从 1 开始递增,此列名为 'rn'", defaultValue = "true", type = "Boolean")
581 	public void setRownumbers(String rownumbers) {
582 		this.rownumbers = rownumbers;
583 	}
584 
585 	@StrutsTagAttribute(description = "当multiselect为true时设置multiselect列宽度", type="Integer", defaultValue="20")
586 	public void setMultiselectWidth(String multiselectWidth) {
587 		this.multiselectWidth = multiselectWidth;
588 	}
589 
590 	@StrutsTagAttribute(description = "设置初始的页码", type="Integer", defaultValue = "1")
591 	public void setPage(String page) {
592 		this.page = page;
593 	}
594 
595 	@StrutsTagAttribute(description = "当值为 true 时,让所选择的行可见", type = "Boolean", defaultValue = "false")
596 	public void setScrollrows(String scrollrows) {
597 		this.scrollrows = scrollrows;
598 	}
599 
600 	@StrutsTagAttribute(description = "是否在导航按钮条中显示“新增”按钮", defaultValue = "true", type = "Boolean")
601 	public void setNavigatorAdd(String navigatorAdd) {
602 		this.navigatorAdd = navigatorAdd;
603 	}
604 
605 	@StrutsTagAttribute(description = "是否在导航按钮条中显示“删除”按钮", defaultValue = "true", type = "Boolean")
606 	public void setNavigatorDelete(String navigatorDelete) {
607 		this.navigatorDelete = navigatorDelete;
608 	}
609 
610 	@StrutsTagAttribute(description = "是否在导航按钮条中显示“编辑”按钮", defaultValue = "true", type = "Boolean")
611 	public void setNavigatorEdit(String navigatorEdit) {
612 		this.navigatorEdit = navigatorEdit;
613 	}
614 
615 	@StrutsTagAttribute(description = "是否在导航按钮条中显示“刷新”按钮", defaultValue = "true", type = "Boolean")
616 	public void setNavigatorRefresh(String navigatorRefresh) {
617 		this.navigatorRefresh = navigatorRefresh;
618 	}
619 
620 	@StrutsTagAttribute(description = "是否在导航按钮条中显示“查找”按钮", defaultValue = "true", type = "Boolean")
621 	public void setNavigatorSearch(String navigatorSearch) {
622 		this.navigatorSearch = navigatorSearch;
623 	}
624 
625 	@StrutsTagAttribute(description = "是否在导航按钮条中显示“查看”按钮", defaultValue = "false", type = "Boolean")
626 	public void setNavigatorView(String navigatorView) {
627 		this.navigatorView = navigatorView;
628 	}
629 
630 	@StrutsTagAttribute(description = "新增到导航按钮条中的按钮定义,如: { seperator: { title : 'seperator'  }, hidebutton : { title : 'Show Hide', icon: 'ui-icon-gear', topic: showHideGrid} }")
631 	public void setNavigatorExtraButtons(String navigatorExtraButtons) {
632 		this.navigatorExtraButtons = navigatorExtraButtons;
633 	}
634 
635 	@StrutsTagAttribute(description = "点击导航按钮条中的“新增”和“编辑”按钮时,是否在表格行内编辑,值为 true 时,直接在表格中编辑, 值为 false 时在弹出的 form 中编辑", defaultValue = "true", type = "Boolean")
636 	public void setNavigatorInlineEditButtons(String navigatorInlineEditButtons) {
637 		this.navigatorInlineEditButtons = navigatorInlineEditButtons;
638 	}
639 
640 	@StrutsTagAttribute(description = "是否在表头的下方显示过滤行(在各列头文字正文显示一个文本框)", defaultValue = "false", type = "Boolean")
641 	public void setFilter(String filter) {
642 		this.filter = filter;
643 	}
644 
645     @StrutsTagAttribute(description = "表头下方过滤行的过滤选项,只有 fileter = true 时才生效,如:{ autosearch : false, formtype : vertical }")
646     public void setFilterOptions(String filterOptions) {
647         this.filterOptions = filterOptions;
648     }
649 
650 	@StrutsTagAttribute(description = "定义子表中列的宽度", type="Integer", defaultValue="20")
651 	public void setSubGridWidth(String subGridWidth) {
652 		this.subGridWidth = subGridWidth;
653 	}
654 
655 	@StrutsTagAttribute(description = "加载 subgrid 数据的 url,jqGrid 会把每行的 id 值加到 url 的参数中")
656 	public void setSubGridUrl(String subGridUrl) {
657 		this.subGridUrl = subGridUrl;
658 	}
659 
660 	@StrutsTagAttribute(description = "当为 true 时把 userData 放到底部。用法:如果 userData 的值与 colModel 的值相同,那么此列就显示正确的值,如果不等那么此列就为空", type = "Boolean", defaultValue = "false")
661 	public void setUserDataOnFooter(String userDataOnFooter) {
662 		this.userDataOnFooter = userDataOnFooter;
663 	}
664 
665 	@StrutsTagAttribute(description = "用来指定斑马线行显示的 css 样式类,可以编辑自己的css文件,只有当 altRows 设为 ture时起作用", defaultValue = "ui-priority-secondary")
666 	public void setAltClass(String altClass) {
667 		this.altClass = altClass;
668 	}
669 
670 	@StrutsTagAttribute(description = "是否显示为斑马条纹", type = "Boolean", defaultValue = "true")
671 	public void setAltRows(String altRows) {
672 		this.altRows = altRows;
673 	}
674 
675 	@StrutsTagAttribute(description = "定义向服务器发送请求时的参数名称,是一个 JSON 对象。", defaultValue = "{page:\"page\",rows:\"rows\", sort: \"sidx\",order: \"sord\", search:\"_search\", nd:\"nd\", id:\"id\",oper:\"oper\",editoper:\"edit\",addoper:\"add\",deloper:\"del\", subgridid:\"id\", npage: null, totalrows:\"totalrows\"}")
676 	public void setPrmNames(String prmNames) {
677 		this.prmNames = prmNames;
678 	}
679 
680 	@StrutsTagAttribute(description = "设置文字显示方向,可先值: ltr - 从左到右;rtl - 从右到左", defaultValue = "ltr")
681 	public void setDirection(String direction) {
682 		this.direction = direction;
683 	}
684 
685 	@StrutsTagAttribute(description = "When set this parameter can instruct the server to load the total number of rows needed to work on. Note that rowNum determines the total records displayed in the grid, while rowTotal the total rows on which we operate. When this parameter is set we send a additional parameter to server named totalrows. You can check for this parameter and if it is available you can replace the rows parameter with this one. Mostly this parameter can be combined wit loadonce parameter set to true.", defaultValue = "null", type = "Integer")
686 	public void setRowTotal(String rowTotal) {
687 		this.rowTotal = rowTotal;
688 	}
689 
690 	@StrutsTagAttribute(description = "定义排序列的外观跟行为。数据格式:[false,'vertical',true],第一个参数是说,是否都要显示排序列的图标,false 表示只显示 当前排序列的图标;第二个参数是指图标如何显示,可先值:vertical - 排序图标垂直放置,horizontal - 排序图标水平放置;第三个参数指单击功能:true - 单击列可排序,false - 单击图标排序。说明:如果第三个参数为false则第一个参数必须为ture否则不能排序", type="Array")
691 	public void setViewsortcols(String viewsortcols) {
692 	    this.viewsortcols = viewsortcols;
693 	}
694 
695 	@StrutsTagAttribute(description = "是否在表格顶部显示分页栏,true|false", type = "Boolean", defaultValue = "false")
696 	public void setToppager(String toppager) {
697 	    this.toppager = toppager;
698 	}
699 
700 	@StrutsTagAttribute(description = "在选中表格中的行时(触发 onSelect 事件时)发布的主题,多值之间使用逗号分隔")
701 	public void setOnSelectRowTopics(String onSelectRowTopics) {
702 		this.onSelectRowTopics = onSelectRowTopics;
703 	}
704 
705 	@StrutsTagAttribute(description = "将表格中的行全部选中时(触发 onSelectAll 事件时)发布的主题,多值之间使用逗号分隔")
706 	public void setOnSelectAllTopics(String onSelectAllTopics) {
707 		this.onSelectAllTopics = onSelectAllTopics;
708 	}
709 
710 	@StrutsTagAttribute(description = "对表格中的数据进行排序时(触发 onSortCol 事件时)发布的主题,多值之间使用逗号分隔。 参数: index - 排序列在 colModel 中的位置, iCol - 排序列的 name, sortorder - 排序方向,可能值有 'asc' 或 'desc'")
711 	public void setOnSortColTopics(String onSortColTopics) {
712 		this.onSortColTopics = onSortColTopics;
713 	}
714 
715 	@StrutsTagAttribute(description = "在选中表格中的行时(触发 onCellSelect 事件时)发布的主题,多值之间使用逗号分隔。参数: rowid - 选中单元格所在行的索引, iCol is the index of the cell, cellcontent is the content of the cell, e is the event object element where we click.")
716 	public void setOnCellSelectTopics(String onCellSelectTopics) {
717 		this.onCellSelectTopics = onCellSelectTopics;
718 	}
719 
720 	@StrutsTagAttribute(description = "表格初始化完成后(触发 onGridComplete 事件时)发布的主题,多值之间使用逗号分隔")
721 	public void setOnGridCompleteTopics(String onGridCompleteTopics) {
722 		this.onGridCompleteTopics = onGridCompleteTopics;
723 	}
724 
725 	@StrutsTagAttribute(description = "开始进行行内编辑时(触发 onEditInlineBefore 事件时)发布的主题,多值之间使用逗号分隔")
726 	public void setOnEditInlineBeforeTopics(String onEditInlineBeforeTopics) {
727 		this.onEditInlineBeforeTopics = onEditInlineBeforeTopics;
728 	}
729 
730 	@StrutsTagAttribute(description = "行内编辑成功时(触发 onEditInlineSuccess 事件时)发布的主题,多值之间使用逗号分隔")
731 	public void setOnEditInlineSuccessTopics(String onEditInlineSuccessTopics) {
732 		this.onEditInlineSuccessTopics = onEditInlineSuccessTopics;
733 	}
734 
735 	@StrutsTagAttribute(description = "行内编辑出错时(触发 onEditInlineError 事件时)发布的主题,多值之间使用逗号分隔")
736 	public void setOnEditInlineErrorTopics(String onEditInlineErrorTopics) {
737 		this.onEditInlineErrorTopics = onEditInlineErrorTopics;
738 	}
739 
740 	@StrutsTagAttribute(description = "行内编辑将数据保存到后台后(触发 onEditInlineAfterSave 事件时)发布的主题,多值之间使用逗号分隔")
741 	public void setOnEditInlineAfterSaveTopics(
742 			String onEditInlineAfterSaveTopics) {
743 		this.onEditInlineAfterSaveTopics = onEditInlineAfterSaveTopics;
744 	}
745 
746 	@StrutsTagAttribute(description = "单元格编辑成功时(触发 onCellEditSuccess 事件时)发布的主题,多值之间使用逗号分隔")
747 	public void setOnCellEditSuccessTopics(String onCellEditSuccessTopics) {
748 		this.onCellEditSuccessTopics = onCellEditSuccessTopics;
749 	}
750 
751 	@StrutsTagAttribute(description = "单元格编辑出错时(触发 onCellEditError 事件时)发布的主题,多值之间使用逗号分隔")
752 	public void setOnCellEditErrorTopics(String onCellEditErrorTopics) {
753 		this.onCellEditErrorTopics = onCellEditErrorTopics;
754 	}
755 
756 	@StrutsTagAttribute(description = "A comma delimited list of topics that published when subgrid row is expanded. Set event.originalEvent.orginal.proceed = false in your topic to prevent default action.")
757 	public void setOnSubGridRowExpanded(String onSubGridRowExpanded) {
758 	    this.onSubGridRowExpanded = onSubGridRowExpanded;
759 	}
760 
761 	@StrutsTagAttribute(description = "A comma delimited list of topics that published when a group is clicked.")
762 	public void setOnClickGroupTopics(String onClickGroupTopics) {
763 	    this.onClickGroupTopics = onClickGroupTopics;
764 	}
765 
766 	@StrutsTagAttribute(description = "双击表格中的行时(触发 onDblClickRow 事件时)发布的主题,多值之间使用逗号分隔")
767 	public void setOnDblClickRowTopics(String onDblClickRowTopics) {
768 	    this.onDblClickRowTopics = onDblClickRowTopics;
769 	}
770 
771 	@StrutsTagAttribute(description = "右击表格中的行时(触发 onDblClickRow 事件时)发布的主题,多值之间使用逗号分隔。注意 - 此事件不支持 Opera 浏览器,因为 Opera 浏览器不支持 oncontextmenu 事件")
772 	public void setOnRightClickRowTopics(String onRightClickRowTopics) {
773 	    this.onRightClickRowTopics = onRightClickRowTopics;
774 	}
775 
776 	@StrutsTagAttribute(name = "reloadTopics", description = "重新装载数据时(触发 onReload 事件时)发布的主题,多值之间使用逗号分隔")
777 	public void setReloadTopics(String reloadTopics) {
778 		this.reloadTopics = reloadTopics;
779 	}
780 
781 	@StrutsTagAttribute(description = "行是否可以进行排序,true|false", type = "Boolean", defaultValue="false")
782 	public void setSortableRows(String sortableRows) {
783 		this.sortableRows = sortableRows;
784 	}
785 
786 	@StrutsTagAttribute(description = "Determines the target grid(s) to which the row should be dropped. The option is a string. In case of more than one grid the ids should be delemited with comma - i.e #grid1, #grid2 ", defaultValue = "empty string")
787 	public void setConnectWith(String connectWith) {
788 		this.connectWith = connectWith;
789 	}
790 
791 	@StrutsTagAttribute(description = "Defines the name from  colModel  on which we group. The first value is the first lavel, the second values is the second level and etc. Currently only one level is supported. e.g. ['name']")
792 	public void setGroupField(String groupField) {
793 		this.groupField = groupField;
794 	}
795 
796 	@StrutsTagAttribute(description = "Show/Hide the column on which we group. The value here should be a boolean true/false for the group level. If the grouping is enabled we set this value to true. e.g. [true]")
797 	public void setGroupColumnShow(String groupColumnShow) {
798 		this.groupColumnShow = groupColumnShow;
799 	}
800 
801 	@StrutsTagAttribute(description = "Defines the grouping header text for the group level that will be displayed in the grid. By default if defined the value if {0} which means that the group value name will be displayed. It is possible to specify another value {1} which meant the the total cont of this group will be displayed too. It is possible to set here any valid html content. e.g. ['<b>{0} - {1} Item(s)</b>'] ")
802 	public void setGroupText(String groupText) {
803 		this.groupText = groupText;
804 	}
805 
806 	@StrutsTagAttribute(description = "Defines if the initially the grid should show or hide the detailed rows of the group.", defaultValue = "false", type = "Boolean")
807 	public void setGroupCollapse(String groupCollapse) {
808 		this.groupCollapse = groupCollapse;
809 	}
810 
811 	@StrutsTagAttribute(description = "Defines the initial sort order of the group level. Can be asc for ascending or desc for descending order. If the grouping is enabled the default value is asc. e.g. ['asc']")
812 	public void setGroupOrder(String groupOrder) {
813 		this.groupOrder = groupOrder;
814 	}
815 
816 	@StrutsTagAttribute(description = "Enable or disable the summary (footer) row of the current group level. If grouping is set the default value for the group is false. e.g. [true]")
817 	public void setGroupSummary(String groupSummary) {
818 		this.groupSummary = groupSummary;
819 	}
820 
821 	@StrutsTagAttribute(description = "如果此参数设置为true,我们才能告诉他对数据进行排序发送一个额外的参数给服务器。这样,所有的排序是工作在服务器留下网格只显示分组的数据。如果该参数为false另外之前显示的数据,我们做我们自己的排序,以支持分组。这当然减缓相对大数据的速度。当 datatype is local此参数是无效的数据类型是本地的。", defaultValue = "false", type = "Boolean")
822 	public void setGroupDataSorted(String groupDataSorted) {
823 		this.groupDataSorted = groupDataSorted;
824 	}
825 
826 	@StrutsTagAttribute(description = "收起树节点后,是否显示摘要", defaultValue = "false", type = "Boolean")
827 	public void setGroupShowSummaryOnHide(String groupShowSummaryOnHide) {
828 		this.groupShowSummaryOnHide = groupShowSummaryOnHide;
829 	}
830 
831 	@StrutsTagAttribute(description = "展开树节点的图标样式类", defaultValue = "ui-icon-circlesmall-plus")
832 	public void setGroupPlusIcon(String groupPlusIcon) {
833 		this.groupPlusIcon = groupPlusIcon;
834 	}
835 
836 	@StrutsTagAttribute(description = "收起树节点的图标样式类", defaultValue = "ui-icon-circlesmall-minus")
837 	public void setGroupMinusIcon(String groupMinusIcon) {
838 		this.groupMinusIcon = groupMinusIcon;
839 	}
840 
841 	@StrutsTagAttribute(description = "表格对应的查询表单(form) 的 ID")
842     public void setSearchForm(String searchForm) {
843         this.searchForm = searchForm;
844     }
845 }