Guest User

Untitled

a guest
Jul 18th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. Ext.CrudFormPanel = Ext.extend(Ext.FormPanel, {
  2. reloadCombos: function(json) {
  3. var combos = this.findByType('combo');
  4. Ext.each(combos, function(combo) {
  5. if (json.data[combo.displayField] && !Ext.isEmpty(combo.getValue())) {
  6. combo.setRawValue(json.data[combo.displayField]);
  7. }
  8. });
  9. },
  10. reloadRadioGroups: function(json) {
  11. var radiogroups = this.findByType('radiogroup');
  12. Ext.each(radiogroups, function(group) {
  13. if (json.data[group.name]) {
  14. group.reloadGroup(json.data[group.name]);
  15. }
  16. });
  17. },
  18. onActionComplete: function(form, action) {
  19. if (action.type == 'load') {
  20. var json = Ext.decode(action.response.responseText);
  21. this.reloadCombos(json);
  22. this.reloadRadioGroups(json);
  23. }
  24. },
  25. initComponent: function() {
  26. Ext.CrudFormPanel.superclass.initComponent.apply(this, arguments);
  27. this.add({xtype: 'html', id: 'validation-box', html: ''});
  28. this.getForm().on('actioncomplete', this.onActionComplete, this);
  29. }
  30. });
Add Comment
Please, Sign In to add comment