[Go] ext Grid (EXTJS) and double click events

Source: Internet
Author: User

Example 1:

  1. 1. Double-click
  2. var cb = New Ext.grid.RowSelectionModel ({
  3. Singleselect:true //If the value is False, it indicates that multiple rows can be selected, otherwise only one row is selected
  4. });
  5. var Alarmgrid = New Ext.grid.GridPanel ({
  6. }
  7. Alarmgrid.addlistener (' Rowdblclick ', ROWDBLCLICKFN);
  8. function Rowdblclickfn (grid, rowindex, e) {
  9. Grid.getselectionmodel (). each (function (REC) {
  10. Alert (Rec.get (fieldName)); //fieldname, field names in the record
  11. });
  12. }
  13. 2. Click
  14. var cb = New Ext.grid.RowSelectionModel ({
  15. Singleselect:true //If the value is False, it indicates that multiple rows can be selected, otherwise only one row is selected
  16. });
  17. var Alarmgrid = New Ext.grid.GridPanel ({
  18. }
  19. Alarmgrid.addlistener (' Rowclick ', ROWCLICKFN);
  20. function Rowclickfn (grid, rowindex, e) {
  21. Grid.getselectionmodel (). each (function (REC) {
  22. Alert (Rec.get (fieldName)); //fieldname, field names in the record
  23. });
  24. }

Add when initializing: The above one is written separately. Add a click-to-double event, mainly using AddListener to add ' rowclick ' and ' Rowdblclick ' for the click and double click events. And initialize the configuration, as long as the configuration grid inside the listeners can be!

Java code
  1. var cb = New Ext.grid.RowSelectionModel ({
  2. Singleselect:true //If the value is False, it indicates that multiple rows can be selected, otherwise only one row is selected
  3. });
  4. var Alarmgrid = New Ext.grid.GridPanel ({
  5. }
  6. Alarmgrid.addlistener (' Rowclick ', ROWCLICKFN);
  7. function Rowclickfn (grid, rowindex, e) {
  8. Grid.getselectionmodel (). each (function (REC) {
  9. Alert (Rec.get (fieldName)); //fieldname, field names in the record
  10. });
  11. }
  12. var Grid = New Ext.grid.GridPanel ({
  13. Store: <your Datastore>
  14. Columns:[<your Columns>],
  15. Renderto:' Example-grid ',
  16. Height:
  17. listeners:{
  18. Click
  19. Rowdblclick:function (Grid,row) {
  20. Alert ("Rowdblclick")
  21. },
  22. Double click
  23. Rowclick:function (Grid,row) {
  24. Alert (' Rowclick ')
  25. }
  26. }
  27. });

Example 2:

How does the ExtJs4.0 table double-click event be implemented?

Check out the relevant examples and Google, but the tests were unsuccessful. Please use the extjs4 of the hero to guide under, greatly appreciated!

An example attached to Google:

?
12345678910111213141516171819202122232425262728293031 var cb = new Ext.grid.RowSelectionModel({        singleSelect:true //如果值是false,表明可以选择多行;否则只能选择一行   });     var alarmGrid = new Ext.grid.GridPanel({    }   alarmGrid.addListener(‘rowclick‘, rowclickFn);     function rowclickFn(grid, rowindex, e){        grid.getSelectionModel().each(function(rec){        alert(rec.get(fieldName)); //fieldName,记录中的字段名        });   }     var grid = new Ext.grid.GridPanel({     store: <your datastore>,     columns:[<your columns>],     renderTo:‘example-grid‘   height:200,     listeners:{  //单击         rowdblclick : function(grid,row){             alert("rowdblclick"       },  //双击         rowclick:function(grid,row){             alert(‘rowclick‘          });

Supplementary------------------------------issues

Grid.addlistener (' Itemdblclick ', click, this); function Click (Grid, rowindex, e) {alert (11);} The double-click event is Itemdbclick, and clicking the event is ItemClick.

[Go] ext Grid (EXTJS) and double click events

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.