kveeiv / extjs-boxselect

Ext.ux.form.field.BoxSelect
http://kveeiv.github.com/extjs-boxselect/examples/boxselect.html
MIT License
108 stars 53 forks source link

Stack overflow on saving non-empty disabled boxselect #8

Closed guntiso closed 12 years ago

guntiso commented 12 years ago

Stack overflow on saving non-empty disabled boxselect. ext-4.0.7-gpl. No such error if boxselects are replaced with ext comboboxes. Workaround is to clear disabled boxselects - code below.

  saveIt: function(button) {
    var win    = button.up('window'),
    form   = win.down('form'),
    record = form.getRecord(),
    values = form.getValues();

    // can not store.sync() non-empty disabled box selects - stack overflow!
    var boxSelects = ["#construction_board_ids", "#municipality_ids", "#adm_area_ids"];
    for (var i = 0; i < boxSelects.length; i++) {
      var boxSel = form.down(boxSelects[i]);
      if (boxSel.isDisabled()) {
        boxSel.clearValue();
      }
    }

    record.set(values);
    win.close();
    this.getMyStore().sync();
  },
kveeiv commented 12 years ago

The issue here I believe was that records were being set as the value which ExtJS's json encoding cannot handle. ExtJS 4.1 and extjs-boxselect-2.0.0 should resolve this by returning the associated valueField values instead of the full records.