0
在rails中,我使用jeditable進行內聯編輯的表格。強制XHR提交表單與Turbolinks
要從生成的表單返回適合jeditable的響應,請使用request.xhr?在我的控制器是這樣的:
if request.xhr?
# *** repond with the new value ***
render :text => params[:order_item].values.first
end
我的TD是這樣的,我已經嘗試添加的數據沒有的TurboLink身體(只是爲了實驗),td標籤和按鈕標籤(見下面表格)
<td data-no-turbolink="true">
<span class="editable" data-id="31330" data-name="order_item[actual_price]" title="Click to edit..">46.0</span>
<script type="text/javascript">
</script>
</td>
當我點擊是由腳本生成這樣一個形式的細胞:
<td data-no-turbolink="true">
<span class="editable" data-id="31330" data-name="order_item[actual_price]">
<form style="display: inline">
<input name="order_item[price_override]">
<button type="submit" >Ok</button>
<button type="cancel">Cancel</button>
</form>
</span>
</td>
我覺得我失去了Turbolinks是如何工作的一些essentional理解,有沒有辦法迫使此表格提交通過XHR?