`

struts2.2-jquery-plugin学习HTML的写法(六)

 
阅读更多
<?xml version="1.0" encoding="utf-8"?>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Struts2 jQuery Grid Plugin Showcase</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />
	<meta http-equiv="keywords" content="struts2,jquery, hibernate, plugin,showcase, grid" />
	<meta http-equiv="description" content="Showcase for Struts2 jQuery Grid Plugin and Full Hibernate Struts2 Plugins" />
	<link href="styles/layout.css" rel="stylesheet" type="text/css" />



<script type="text/javascript" src="/js/showcase.js"></script>
   <sj:head
   		locale="zh_CN"
    	loadAtOnce="true"
    	compressed="false"
    	jquerytheme="showcase"
    	customBasepath="themes"
    	loadFromGoogle="false"
    	debug="true"
    />
   

  
</head>
<body>

<div id="mygridfilter"></div>
	<!-- 检索数据action:urlproductUnitAction -->
	<s:url id="urlgoodsUnitAction" action="goodsUnitAction"/>

	<!-- 添加数据 -->
	<s:url id="urleditGoodsUnit" action="editGoodsUnit"/>
   <sjg:grid
    	id="gridtable"
    	caption="商品单位列表"
    	dataType="json"
    	href="%{urlgoodsUnitAction}"
    	pager="true"
    	gridModel="gridModel"
    	rowList="10,15,20"
    	rowNum="10"
    	rownumbers="true"
    	navigator="true"
    	viewrecords="true"
    	editurl="%{urleditGoodsUnit}"
    	navigatorDelete="true"
    	multiselect="true"
    	navigatorView="true"
        navigatorExtraButtons="{
                hidebutton : { 
                       title : 'Show/Hide', 
			    	   icon: 'ui-icon-wrench', 
			    	   topic: 'showcolumns'
                }
        }"
    	onSelectRowTopics="rowselect"
    	onEditInlineSuccessTopics="oneditsuccess"
    	
    	navigatorSearchOptions="{multipleSearch:true}"
    	
    >
    	<sjg:gridColumn name="id" index="id" title="编号" formatter="integer" sortable="true" editable="false" searchoptions="{sopt:['eq','ne','lt','gt','cn']}"/>
    	<sjg:gridColumn name="cd" index="cd" title="编码" sortable="true"  editable="true" searchoptions="{sopt:['eq','ne','lt','gt','cn']}" hidedlg="true"/>
    	<sjg:gridColumn name="name"index="name" title="名称" sortable="true"  editable="true" searchoptions="{sopt:['eq','ne','lt','gt','cn']}"/>
    	<sjg:gridColumn name="byname" index="byname" title="别名" sortable="true"  editable="true" searchoptions="{sopt:['eq','ne','lt','gt','cn']}"/>
    	<sjg:gridColumn name="memCode" index="memCode" title="助记符" sortable="true"  editable="true" searchoptions="{sopt:['eq','ne','lt','gt','cn']}"/>
    	<sjg:gridColumn name="memo" index="memo" title="备注" sortable="true"  editable="true" searchoptions="{sopt:['eq','ne','lt','gt','cn']}"/>
    </sjg:grid>

    <sj:submit id="grid_edit_addbutton" value="Add Row"  onClickTopics="rowadd" button="true"/>
    <sj:submit id="grid_edit_searchbutton" value="Serach" onClickTopics="searchgrid" button="true"/>
    <sj:submit id="grid_edit_colsbutton" value="Hide/Show" onClickTopics="showcolumns" button="true"/>
 
 <script >
    $.subscribe('rowselect', function(event,data) {
        $("#gridinfo").html(''+event.originalEvent.id+'');
    });
    $.subscribe('rowadd', function(event,data) {
        $("#gridtable").jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false});
  	});
    $.subscribe('searchgrid', function(event,data) {
        $("#gridtable").jqGrid('searchGrid', {sopt:['cn','bw','eq','ne','lt','gt','ew']} );
  	});
    $.subscribe('showcolumns', function(event,data) {
   		$.struts2_jquery.require("js/plugins/grid.setcolumns.js");
        $("#gridtable").jqGrid('setColumns',{});
  	});
  	
  	
</script>

  <div id="gridinfo" class="ui-widget-content ui-corner-all"></div>
</body>
</html> 
 

 注意:所使用的标签的主题是官方案例所提供:www.

写道
效果图:


 



  • 大小: 28 KB
分享到:
评论
1 楼 hxjl 2012-02-09  
你好,我想请教下<sjg:grid> 中设置与 jqGrid 对应的 jsonReader 参数如何设置?谢谢!

相关推荐

Global site tag (gtag.js) - Google Analytics