jQuery UI Widgets › Forums › Grid › Are widgets using createwidget cached
Tagged: createwidget, emberjs, javascript data grid, javascript grid, jquery grid, jqxgrid, js grid
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 8 years, 9 months ago.
-
Author
-
It seems that’s not the case as I notice performance degradation when more rows are rendered. Were using it to create emberJS components and add them to grid cells. Here’s the code:
createwidget: function(row, column, value, htmlElement){if(value === ‘jqxgrid-multiselect’){
var componentObj = {};
componentObj.name = ‘jpma-multiselect’;
componentObj.type = ‘component’;
componentObj.singleColumn = ‘singleColumn’;var props = [];
props.push({key: ‘content’, value: [{
code: ‘option1’,
value: ‘Option 1’
}, {
code: ‘option2’,
value: ‘Option 2’
}
]});
props.push({key: ‘optionValuePath’, value: ‘code’});
props.push({key: ‘optionLabelPath’, value: ‘value’});
props.push({key: ‘dropdownLabel’, value: ‘selectedItem’});
props.push({key: ‘placeholder’, value: ‘selectedItem’});
props.push({key: ‘selectedValue’, value: ‘selectedItem’});
props.push({key: ‘showOptions’, value: ‘false’});componentObj.props = props;
var component = $this._createComponent(componentObj);
component.set(‘htmlElement’, htmlElement);component.on(‘didInsertElement’, function() {
var subComponentElement = this.get(‘element’);
this.$(subComponentElement).addClass(‘fill-container show-block’);
this.$(subComponentElement).appendTo($(this.get(‘htmlElement’)));
});
component.append();
}
},
initwidget: function(row, column, value, htmlElement){
/* jshint unused:false */
}Oh, and I should probably say that we are using virtualmode.
Hi lorenzopt,
Yes, they are cached and you should update them in initwidget callback function. Also the performance depends much on how these custom widgets are used, created, updated from your code, too.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Thanks for the reply. Do you have an example of how to use initwidgets? I haven’t been able to find one on the site.
Thanks againHi lorenzopt,
We have one Grid sample about createwidget and initwidget on our website. The link to this Grid example is: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/customwidgetscolumn.htm?light
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.