声明性的dojox.grid.datagrid的标头具有onclick事件吗? [英] Declarative dojox.grid.datagrid's header has onclick event?
问题描述
- 是否有可能在dojox.grid.datagrid的标题中单击。
-
我尝试在标头的onclick中调用一个函数。但是它不起作用。
- Is it possible to have onclick in dojox.grid.datagrid's header.
I tried calling a function in header's onclick.. but it doesn't work.
<div class="claro" id="cvsd" name="dataGrid" onclick="getConnect('inner__cvsd');setWidgetproperty(this.id,'xy','inner__cvsd');" ondblclick="editCustomGrid(this.id)" onmouseup="setDocStyle(this.id)" style="height: 200px; left: 44px; position: absolute; top: 114px; width: 950px;">
<table class="claro" dojotype="dojox.grid.DataGrid" id="inner__cvsd" rowselector="10px" style="height: 180px; width: 400px;">
<thead>
<tr>
<th field="Column1" id="Column1_2" width="100px" onclick="getConnect();">
Column1
</th>
</tr>
</thead>
</table>
<input id="hidden__cvsd" name="dataGrid" style="display:none;" type="hidden">
推荐答案
有一个名为 onHeaderCellClick
的事件可能会完成这项工作。如果您需要了解有关事件等的更多信息,建议您阅读 API文档。
我写了一个示例JSFiddle(网格是通过编程创建的,但是您也可以使用声明性的方法),您可以在此处找到 。
There's an event called onHeaderCellClick
which will probably do the job. If you need to get more information about events and such things I recommend reading the API Documentation.
I wrote an example JSFiddle (grid is created programmatically, but you can do that declarative too) which you can find here.
我用来调用事件的代码如下:
The code that I use to call the event is the following:
onHeaderCellClick: function() {
console.log("Header clicked");
},
但是,当然,您可以根据自己的喜好进行更改。
But of course, you can change this with whatever you like.
这篇关于声明性的dojox.grid.datagrid的标头具有onclick事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!