var sources = {
1: [{value: 24, text: 24}, {value: 30, text: "30 standard"},{ value:33, text:33},{value:36, text:36},{value:"sustom",text:"custom"}],
2: [{value: 24, text: 24}, {value: 30, text: "30 standard"},{ value:33, text:33},{value:36, text:36},{value:"sustom",text:"custom"}]
};
$('#range_type').editable({
url: '/post',
pk: 1,
source: [{value: 1, text: 'Gas'}, {value: 2, text: 'electric'}],
title: 'Select type of range',
success: function(response, newValue) {
$('#range_size').editable('option', 'source', sources[newValue]);
$('#range_size').editable('setValue', null);
}
});
$('#range_size').editable({
url: '/post',
pk: 1,
title: 'Select Range Size',
sourceError: 'Please, select range type first'
});
$.mockjax({
url: '/post',
responseTime: 400,
response: function(settings) {
if(settings.data.value == 'err') {
this.status = 500;
this.responseText = 'Validation error!';
} else {
this.responseText = '';
}
}
});