可裁剪的动态目标值

编程入门 行业动态 更新时间:2024-10-24 14:27:39
本文介绍了可裁剪的动态目标值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用jeditable,它真的很棒!我只是在计算如何动态更改目标URL时遇到了一些麻烦。

I'm using jeditable and it works really great! I'm just having some trouble figuring out how to dynamically change the target URL.

jeditable绑定到我想要内联编辑的值表。 所以我有:

jeditable is bound to a table of values that I want to edit inline. So I have:

<td id="<%= col.id %>_<%= i.id %>" class="edit">

id是在服务器端编辑此项目时需要知道的两个值的混搭。

The id is a mashup of two values I need to know to edit this item on the server side.

我的js是:

$(document).ready(function() { $('.edit').editable("/items/1", { id : "column_id_item_id", submitdata : function(value, settings){ return { data_template_id: '<%= @data_template.id%>}', format : 'json'} } , method : 'PUT', }); });

注意目标网址是/ items / 1 那个/ 1是我需要改变的,以及它在td id中内置的值之一。

Note the target url is "/items/1" That /1 is what I need to change, and its one of the values built in to the td's id.

所以我的问题是如何从id的值中获取值元素点击并用它来修改jeditable的目标参数。

So my question is how do I take the value from the id of the element clicked and use it to modify the target parameter for jeditable.

其他一切正常,我现在每次只编辑第1项: )

Everything else is working fine, I'll just edit item 1 every time right now :)

推荐答案

将onsubmit设置为函数并在那里更改目标。

Set onsubmit to a function and change the target there.

$('whatever').editable("", { onsubmit: function (settings) { settings.target = "/set/target/to/whatever/you/like"; } });

更多推荐

可裁剪的动态目标值

本文发布于:2023-11-30 11:58:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649867.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:目标值   动态

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!