View unanswered posts | View active topics It is currently 2021-04-21 9:27



Reply to topic  [ 1 post ] 
 如何判断鼠标点击的grid的哪个单元格? 
Author Message
TWaver开发组
User avatar

Joined: 2017-02-22 10:01
Posts: 476
Post 如何判断鼠标点击的grid的哪个单元格?
可以用grid.getCellObject():
Code:
network.getView().addEventListener('mousedown', function (e) {
  var grid = network.getElementAt(e);
  if (grid instanceof twaver.Grid) {
    var point = network.getLogicalPoint(e);
    var cellObject = grid.getCellObject(point.x, point.y);
    /*{
                        "rowIndex": r,
                        "columnIndex": c,
                        "rect": rect
                    }*/

  }
});

其中cellObject包含了所需要的值。


Attachments:
WX20170417-174601.png
WX20170417-174601.png [ 21.29 KiB | Viewed 27009 times ]
2017-04-17 17:53
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: