var penalty = new csp();
penalty.name(args.name);
penalty.label(args.label);
- penalty.block_list(formatBlockList(args.block_list));
+ penalty.block_list(args.block_list);
fieldmapper.standardRequest(
['open-ils.permacrud', 'open-ils.permacrud.create.csp'],
}
);
}
-
-function formatBlockList(list) {
- var str = '';
- for(var idx in list)
- str += list[idx] + '|';
- return str.replace(/\|$/, '');
-}
-
function spGridChanged(item, attr, oldVal, newVal) {
var sp = spCache[spGrid.store.getValue(item, 'id')];
console.log("changing cm " + sp.id() + " object: " + attr + " = " + newVal);
- if(attr == 'block_list') {
- sp[attr](formatBlockList(newVal));
- } else {
- sp[attr](newVal);
- }
+ sp[attr](newVal);
sp.ischanged(true);
spSaveButton.setDisabled(false);
}
fieldmapper.standardRequest(
['open-ils.permacrud', 'open-ils.permacrud.delete.csp'],
- { async: true,
- params: [openils.User.authtoken, id],
- oncomplete: function(r) {
- if(obj = openils.Util.readResponse(r)) {
- spGrid.store.deleteItem(item);
- }
- _deleteFromGrid(list, ++idx);
- }
- }
+ { async: true,
+ params: [openils.User.authtoken, id],
+ oncomplete: function(r) {
+ if(obj = openils.Util.readResponse(r)) {
+ spGrid.store.deleteItem(item);
+ }
+ _deleteFromGrid(list, ++idx);
+ }
+ }
);
}
this.addOption({value:'CIRC', label:'CIRC'});
this.addOption({value:'RENEW', label:'RENEW'});
this.addOption({value:'HOLD', label:'HOLD'});
+ },
+ attr : function(name, value) {
+ if(name == 'value' && value == null) {
+ var val = this.inherited('attr', arguments);
+ var str = '';
+ for(var i in val)
+ str += val[i] + '|';
+ return str.substring(0, str.length - 1);
+ } else {
+ return this.inherited('attr', arguments);
+ }
}
}
);
cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Label</th>
<th field="block_list" width='auto' editable='true'
cellType='dojox.grid.cells._Widget'
- widgetClass='openils.widget.StandingPenaltyBlockedSelector' jsId='formatBlockList'>Block List</th>
+ widgetClass='openils.widget.StandingPenaltyBlockedSelector'>Block List</th>
</tr>
</thead>
</table>