Is there any reference on how to add additional methods to IG controls?
Hi Josh,No, I don't believe we have an official guide on this, so you can just follow the general rules for extending jQuery functionality or a jQuery UI widget.Here are some links that get you started:http://docs.jquery.com/Plugins/Authoring#Defaults_and_Options http://paulirish.com/2010/duck-punching-with-jquery/ http://stackoverflow.com/questions/2525247/how-to-extend-a-jquery-ui-widget-1-7 For example, here's how the JSONPDataSource extends the regular igDataSource:
$.ig.JSONPDataSource = $.ig.JSONPDataSource || $.ig.DataSource.extend({init: function (options) { <do something unique to the JSONPDataSource, rather than the igDataSource's implementation of the method> }});Hope this helps you out.Cheers,Borislav
Any chance you could give me an example of how to add a method to the combobox? I've tried something similar to your example with the DataSource, but it's telling me that Combo doesn't have an extend method.
Neither of these work:
$.ui.igCombo.extend
$.ig.Combo.extend
Hi Josh,
I wrote for you a sample which extends igCombo, adds custom border and ability to set datasource from string with coma separators.
<script type="text/javascript"> $.widget('ui.igMyCombo', $.ui.igCombo, { options: { myBorder: null, myStringData: null }, _create: function () { $.ui.igCombo.prototype._create.apply(this); var border = this.options.myBorder, data = this.options.myStringData; if (border) { this.mainElem.css('border', border); } if (data) { this.options.dataSource = data.split(','); this.dataBind(); } } }); // // example to use $(function () { $('#combo1').igMyCombo({ mode: 'dropdown', myBorder: '1px solid red', myStringData: 'one,two,three,four' }); });</script><span id="combo1"></span>