javascript - Slickgrid onClick... How to update dataView without global dataView? -
short version: possible access dataview within scope of subscription method?
grid.onclick.subscribe(function(e, args) { var rowdata= args.grid.getdataitem(args.row); //want update data in dataview row });
(elsewhere in module have)
dataview.onrowschanged.subscribe(function(e, args){ grid.invalidaterows(args.rows); grid.render(); });
long version: i've created generic javascript module slickgrid within application reuse. takes columncollection, datacollection, filterargs, filtermethods, , i'm in scenario there business logic in onclick that, organization standpoint, don't want in generic module. if pass clickmethod module, how update dataview on click. (i hope makes sense.)
module like...
var options = _.extend(default_options, params.options); var dataview = new slick.data.dataview({inlinefilters:true}); var grid = new slick.grid('#grid', dataview, params.columnsobj, options); if(options.myclickmethod !== undefined){ grid.onclick.subscribe(function(e,args){ options.myclickmethod(e,args); }); }
grid.getdata() returns dataview object
var dataview = args.grid.getdata();
Comments
Post a Comment