Guest User

Untitled

a guest
Oct 12th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. tableTempStore = new Ext.data.JsonStore({
  2. url: objectUrlAddress,
  3. baseParams: {
  4. 'objectID': objectID
  5. },
  6. root: 'Fields',
  7. fields: [{
  8. name: 'Type',
  9. type: 'int'
  10. }, {
  11. name: 'Value'
  12. }, {
  13. name: 'IsRequired',
  14. type: 'bool'
  15. }, {
  16. name: 'Identifier'
  17. }, {
  18. name: 'Data'
  19. }],
  20. listeners: {
  21. load: function(obj, records) {
  22. Ext.each(records, function(rec) {
  23.  
  24. var item = null;
  25. switch (rec.get('Type')) {
  26. case 0:
  27. item = new Ext.form.NumberField();
  28. item.id = rec.get('Identifier');
  29. item.fieldLabel = rec.get('Hint');
  30. var isRequired = rec.get('IsRequired');
  31. item.anchor = '100%';
  32. item.allowBlank = !isRequired;
  33. item.disabled = editDisabled;
  34. item.value = rec.get('Data');
  35. break;
  36. case 1:
  37. item = new Ext.form.NumberField();
  38. item.id = rec.get('Identifier');
  39. item.fieldLabel = rec.get('Hint');
  40. var isRequired = rec.get('IsRequired');
  41. item.anchor = '100%';
  42. item.allowBlank = !isRequired;
  43. item.allowDecimals = true;
  44. item.disabled = editDisabled;
  45. item.value = rec.get('Data');
  46. break;
  47. }
  48. if (item != null) {
  49. grid.add(item);
  50. tableValue = Ext.getCmp('propGrid').doLayout();
  51. source[item.fieldLabel] = tableValue;
  52. //grid.doLayout();
  53. }
  54. });
  55. grid.setSource(source);
  56. }
  57. }
  58. });
  59.  
  60. grid = new Ext.grid.PropertyGrid({
  61. title: 'Properties Grid',
  62. id: 'propGrid',
  63. autoFill: true,
  64. autoHeight: true,
  65. width: 600
  66. });
Add Comment
Please, Sign In to add comment