大佬教程收集整理的这篇文章主要介绍了在dojox.grid.DataGrid中选择特定行时执行事件,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在onready函数中,在grID.startup之后,执行以下操作:
dojo.connect(grID, "onRowClick", grID, function(evt){
var IDx = evt.rowIndex,
item = this.getItem(IDX);
// get the ID attr of the SELEcted row
var value = this.store.getValue(item, "ID");
//open a dialog or new window or redirect to new JsP
//to redirect to new Jsp, you can set window.LOCATIOn.href to the new url
//to open a new dialog, i suggest using dijit.dialog
//see: http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/test_Dialog.HTML
//to open a new window, use window.open
//http://www.pageresource.com/Jscript/jwinopen.htm
});
更多网格示例,请访问:http ://dojotoolkit.org/documentation/tutorials/1.6/working_grID/
api文档列出了所有可能的事件:http ://dojotoolkit.org/API/1.6/dojox/grID/DataGrID#onApplyCellEdit
我有一个运行良好的代码,并在dojox.grid.DataGrid的网格中向我显示了一些值。现在,我想执行一些事件,例如当我单击特定的行时,它将重定向我到新的JSP页面。或将打开一个窗口,我可以做点什么。怎么做
?请帮帮我。谢谢。
代码是::
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="MyPackage.PopulateTextbox" %>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/resources/dojo.css";
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.7/dijit/themes/nihilo/nihilo.css";
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojox/grid/resources/Grid.css";
@import "http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojox/grid/resources/nihiloGrid.css";
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.7/dojo/dojo.js" djConfig="isDebug: false,parseOnLoad: true"></script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojo.data.ItemFileWriteStore");
</script>
<%
String temp1;
PopulateTextbox obj = new PopulateTextbox();
temp1 = obj.method();
request.setAttribute("variable",temp1);
%>
<script type="text/javascript">
dojo.ready(function(){
var myVar = <%= request.getAttribute("variable") %>
var storedata={
identifier:"ID",label:"name",items: myVar
};
var store = new dojo.data.ItemFileWriteStore({data: storedata});
var gridStructure =[[
{ field: "ID",name: "ID_Emp",width: "40%"
},{
field: "Names",name: "Name",width: "40%"
}
]
];
var grid = new dojox.grid.DataGrid({
id: 'grid',store: store,structure: gridStructure,},document.createElement('div'));
/*append the new grid to the div*/
dojo.byId("gridDiv").appendChild(grid.domNodE);
/*Call startup() to render the grid*/
grid.startup();
});
</script>
<title>Dojo Data</title>
</head>
<body>
<div id="gridDiv" dojoType="dojox.grid.DataGrid" title="Simple Grid" style="width:1000px; height:500px;">
</div>
</body>
</html>
以上是大佬教程为你收集整理的在dojox.grid.DataGrid中选择特定行时执行事件全部内容,希望文章能够帮你解决在dojox.grid.DataGrid中选择特定行时执行事件所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。