IconBrowser.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @class Ext.chooser.IconBrowser
  3. * @extends Ext.view.View
  4. * @author Ed Spencer
  5. *
  6. * This is a really basic subclass of Ext.view.View. All we're really doing here is providing the template that dataview
  7. * should use (the tpl property below), and a Store to get the data from. In this case we're loading data from a JSON
  8. * file over AJAX.
  9. */
  10. Ext.define('Ext.chooser.IconBrowser', {
  11. extend: 'Ext.view.View',
  12. alias: 'widget.iconbrowser',
  13. uses: 'Ext.data.Store',
  14. singleSelect: true,
  15. overItemCls: 'x-view-over',
  16. itemSelector: 'div.thumb-wrap',
  17. tpl: [
  18. // '<div class="details">',
  19. '<tpl for=".">',
  20. '<div class="thumb-wrap">',
  21. '<div class="thumb">',
  22. (!Ext.isIE6? '<img src="icons/{thumb}" />' :
  23. '<div style="width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'icons/{thumb}\')"></div>'),
  24. '</div>',
  25. '<span>{name}</span>',
  26. '</div>',
  27. '</tpl>'
  28. // '</div>'
  29. ],
  30. initComponent: function() {
  31. this.store = Ext.create('Ext.data.Store', {
  32. autoLoad: true,
  33. fields: ['name', 'thumb', 'url', 'type'],
  34. proxy: {
  35. type: 'ajax',
  36. url : 'icons.json',
  37. reader: {
  38. type: 'json',
  39. root: ''
  40. }
  41. }
  42. });
  43. this.callParent(arguments);
  44. this.store.sort();
  45. }
  46. });