PageRenderTime 24ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/ext-4.1.0_b3/examples/app/nested-loading/app/view/book/View.js

https://bitbucket.org/srogerf/javascript
JavaScript | 54 lines | 42 code | 5 blank | 7 comment | 0 complexity | dc436337a0ca4b3b22ff37b93b528c1d MD5 | raw file
  1. /**
  2. * The view which displays information about a speficied book
  3. * @extends Ext.panel.Panel
  4. */
  5. Ext.define('Books.view.book.View', {
  6. alias: 'widget.bookview',
  7. extend: 'Ext.panel.Panel',
  8. requires: ['Ext.Img'],
  9. initComponent: function() {
  10. Ext.apply(this, {
  11. cls: 'item-ct',
  12. flex: 2,
  13. border: false,
  14. autoScroll: true,
  15. layout: {
  16. type : 'hbox',
  17. align: 'middle',
  18. pack : 'center',
  19. availableSpaceOffset: Ext.getScrollbarSize().width
  20. },
  21. items: [{
  22. xtype: 'image',
  23. itemId: 'imgCt',
  24. src: Ext.BLANK_IMAGE_URL,
  25. margin: '0 20 0 0',
  26. width : 250,
  27. height: 308
  28. }, {
  29. xtype: 'component',
  30. tpl: [
  31. '<div class="name">{name} <span>${price}</span></div>',
  32. '<div class="author">By {author}</div>',
  33. '<div class="detail">{detail}</div>'
  34. ],
  35. itemId: 'contentCt',
  36. width: 500,
  37. border: false
  38. }]
  39. });
  40. this.callParent(arguments);
  41. },
  42. /**
  43. * Binds a record to this view
  44. */
  45. bind: function(record) {
  46. this.child('#imgCt').setSrc(record.get('image'));
  47. this.child('#contentCt').update(record.getData());
  48. }
  49. });