x-editable:如何使用字段值更新 post URL 本身?
x-editable: How to update the post URL itself with field values?
我正在尝试 post 的 API 构造如下:/device/invoiceNumber/{invoiceNumber}/{portableUnitId}
其中括号中的值必须替换为 bootstrap-table 中动态添加的值。我可以在另一个函数中生成自定义 URL,但我这里的内容不起作用:
$(this).data('url', postInvNumUrl);
有什么想法吗?
我找到了解决方案,您必须更新 editable
本身的选项:
// This is where the magic happens
$(this).editable('option', 'url', postInvNumUrl);
// Not sure if this is needed anymore
$(this).data('url', postInvNumUrl);
我正在尝试 post 的 API 构造如下:/device/invoiceNumber/{invoiceNumber}/{portableUnitId}
其中括号中的值必须替换为 bootstrap-table 中动态添加的值。我可以在另一个函数中生成自定义 URL,但我这里的内容不起作用:
$(this).data('url', postInvNumUrl);
有什么想法吗?
我找到了解决方案,您必须更新 editable
本身的选项:
// This is where the magic happens
$(this).editable('option', 'url', postInvNumUrl);
// Not sure if this is needed anymore
$(this).data('url', postInvNumUrl);