[C#]
//Assign a double click handler
gridView1.DoubleClick += new EventHandler(gridView1_DoubleClick)
private void gridView1_DoubleClick(object sender, EventArgs e)
{
GridView detailGrid = (sender as GridView)
GridHitInfo hitInfo = (detailGrid.CalcHitInfo((e as MouseEventArgs).Location)
//Leave if the user didn't double-click in a cell
if (hitInfo.InRowCell == false)
return
//Leave if the user didn't double-click in the "Person Name" column
if (hitInfo.Column != detailGrid.Columns["PersonName"])
return
//Do something else
}
grid 表头标题栏添加点击事件的方法如下:
在<mx:DataGrid headerRelease="doHeaderRelease(event)"/>调用下面方法获取所在列以及dataField和headerText
在用datagrid的时候我们可能要用到点击表头来触发一个function,这里有个简单的例子。
首先你得有个能用的datagrid。
<div>
<table id="toolbar"></table>
</div>
然后是js里的东西。
function toolbar(){
alert("dd")
$("#toolbar").datagrid({
striped: true,
url:"toolbar",
columns:[[
{field:"name",title:click()},
{field:"sex", title:"性别"},
{field:"age", title:"年龄"},
]],
toolbar:[{
text:'增加',iconCls:'icon-add',handler:function(){
alert(document.getElementById("text").value)}
},
{text:'导入',iconCls:'icon-add',handler:function(){
window.location.href='StuImport.aspx'
Grid.getSelectionModel().on('rowdblclick',function(sm, record, rowIndex ){alert("test")
})
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)