开发者

How to apply plugin in a "live" fashion

Is there a way to apply plugin to element in a "live" fashion, just like we can attach handler that survives ajax calls? Right now开发者_如何学编程 we have some code that uses "cluetip" in a rad grid, but after ajax, it gets dropped.

$('a.clickableSticky').cluetip({
                    splitTitle: '|',
                    showTitle: false,
                    titleAttribute: 'description',
                    activation: 'click',
                    sticky: true,
                    arrows: true,
                    closePosition: 'title'
                });


Live only works on events, so you can't do it with clue tip.

You can still run cluetip on any newly created elements though.

So...

$('#grid').live('gridRefreshEvent', function () {
 $('#grid').find('a.clickableSticky').cluetip({ splitTitle: '|', showTitle: false, titleAttribute: 'description', activation: 'click', sticky: true, arrows: true, closePosition: 'title' });
}

Edit:

If the plugin doesn't provide an event, you can hack the plugin to create your own event by finding the ajax function in their code and adding: $('#grid').trigger('gridRefreshEvent'); somewhere.

You can also try asking RadGrid support about the event. Any non-dumb dev would add basic things like this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜