开发者

Add complex markup with event handlers

How to put开发者_JS百科 into a grid cell not just a string <span>text</span>, but a string with an event handler? This option does not suit me:

<span onclick='function(){...}'>click me</span>

I need to add, for example, such elements in one grid cell:

var $el1 = $('<button>clck me 1</button>').click(function(){...});
var $el2 = $('<button>clck me 2</button>').click(function(){...});
...

I use slick.dataview.


Don't. Either handle click events via SlickGrid by using the onClick event it exposes or use event delegation on a higher level (container or document) to catch it. Add an attribute to the buttons to distinguish them later and decide which handler to execute.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜