在我想要更新我的产品的那一刻。我的按钮被锁定我不知道为什么会发生这种情况,我试图重写这个功能,但它没有用。
项目更新后,应Unable to find a suitable version for polymer, please choose one by typing one of the numbers below:
1) polymer#^1.2.0 which resolved to 1.8.1 and is required by paper-toolbar#1.1.7
2) polymer#^1.1.0 which resolved to 1.8.1 and is required by iron-flex-layout#1.3.2
3) polymer#^1.0.0 which resolved to 1.8.1 and is required by paper-styles#1.2.0
4) polymer#^2.0.0-rc.2 which resolved to 2.0.0-rc.2 and is required by Pokedex
5) polymer#^2.0.0-rc.1 which resolved to 2.0.0-rc.2 and is required by iron-component-page#9bcd9558d7
Prefix the choice with ! to persist it to bower.json
? Answer
刷新表格并重置表格。但它没有。我该如何解决?
$('#update_product')[0].reset(); table.ajax.reload();
html
$('#example tbody').on('click','a', function(e){
var data = table.row( $(this).parents('tr')).data();
hash_id = data[0];
$("#update_product").validate();
BootstrapDialog.show({
type: BootstrapDialog.TYPE_WARNING,
message: function(dialog) {
var $message = $('<div></div>');
var pageToLoad = dialog.getData('pageToLoad');
$message.load(pageToLoad);
return $message;
},
data: {
'pageToLoad': URL_GET_VIEW_UPDATE_PRODUCT
},
closable: false,
buttons:[{
id: 'btn-ok',
cssClass: 'btn-primary',
icon: 'glyphicon glyphicon-send',
label: ' Save',
action: function (e) {
var hash = hash_id;
var description = $('#description').val();
var cost_price = $('#cost_price').val();
var selling_price = $('#selling_price').val();
var wprice = $('#wprice').val();
var min_stock = $('#min_stock').val();
var stock = $('#stock').val();
var max_stock = $('#max_stock').val();
if($("#update_product").valid()){
$.ajax({
url: URL_GET_UPDATE_PRODUCT_PRODUCT,
type: 'POST',
data: {hash: hash, description: description, cost_price: cost_price, selling_price: selling_price, wprice: wprice, min_stock: min_stock, stock: stock, max_stock: max_stock}
}).done(function (data) {
console.log(data);
if (data.msg == 'successfully updated') {
$('#update_product')[0].reset();
table.ajax.reload();
}else if(data.min_stock == 'el stock no puede ser mayor al min'){
BootstrapDialog.show({
type: BootstrapDialog.TYPE_WARNING,
message: 'el stock no puede ser mayor al min'
});
}
});
return false;
}
}
},{
id: 'btn-cancel',
cssClass: 'btn-danger',
icon: 'glyphicon glyphicon-remove',
label: ' Cancel',
action: function (e) {
e.close();
}
}]
});
});