开发者

ExtJS RowButton that cancel row selection

I'm trying to add row buttons to a grid panel. These bu开发者_运维技巧ttons should capture the click event, do their stuff, and prevent the row to be selected.

The problem is that the row behaviour that changes the row selection is running before the button's event (like if the row was capturing it instead of wait to event bubbling).

Is there any way to add a row button that perform its action before the row selection to be able to cancel the event and therefore cancel any other behaviour?


What is your intent?

  1. Is it to completely disable row selection for this grid?
  2. Or prevent row selections from "losing focus"/reseting when a row button is clicked?

If you want to disable row selection from the entire grid (1), set the config item disableSelection to true.

If you want to prevent row selections from being reset everytime the user clicks on your row buttons (2), you can extend Ext.grid.RowSelectionModel and override the initEvents method to register handleMouseDown to handle the cellmousedown instead of the rowmousedown (this will give u access to the columnIndex that originated the event) GridPanel event. Then add some logic to the handleMouseDown method to not update the row selection if the columnIndex is equal to the column index of yours row buttons. In other words, only execute the original handleMouseDown logic if the columnIndex is not equal to the column index of your row buttons.

Hope this helps.


I hadn't got the idea of watch the column, it's very simple to register a listener to cancel the selection of rows. (I would rather the row to wait the event bubbling, but...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜