In the nutshell that is what I ended up doing. Since the "record" object is the model wrapped around some data my link generation is as follows:
Code:
buildLinkFromRecord: function(type, record) {
var me = this, link;
if (type) {
link = '<a href="javascript:void(0)" class="bookmark" data-type="' + type + '" data-rec="' +
Ext.htmlEncode(Ext.encode(record.data)) + '">';
} else {
link = '<a href="#">';
}
return link;
}
And then, after the breadcrumb (which contains multiple links) is inserted I do
Code:
var bookmarks = Ext.select('*[class=bookmark]');
if (bookmarks) {
bookmarks.on('click', function(){
var type = Ext.htmlDecode(this.getAttribute('data-type'));
var raw = Ext.htmlDecode(this.getAttribute('data-rec'));
var data = Ext.JSON.decode(raw);
var record = Ext.create('QuiApplication.model.BookmarkModel', {'type':type, 'data':data});
me.application.fireEvent('openReporting',record);
});
}
I was just wondering if there was an easier way to pass model object as a parameter?