麻烦大家指点下面的这段javascript代码中var o 的selectnode是如何得到参数值id, name, value, parentId的? $(document).ready(function(){//在DOM加载完成时运行的代码
autoFillSingle($("#search-keywords"));//?
$("#tabs").tabs();//?
});
function load(){
$("input").val("");//设定文本框的值
//autoFill($("#search-keywords"));
o = {
url: "treeview",//请求ThesMgrAction的treeview方法
selectnode: function(id, name, value, parentId){
$("#addParentId").val(id), $("#modId").val(id), $("#modName").val(name), $("#modSynonyms").val(value), $("#modParentId").val(parentId), $("#delId").val(id), $("#delParentId").val(parentId)
}//获得当前值
};
$.ajax({
url: o.url,
type: "POST",//请求方式
async: false,//同步请求
data: { //发送到服务器的数据
id: 0
},
success: function(treedata){
o.data = treedata;
}
});
$("#tree").treeview(o);//?
$("#add").click(function(){//添加
if ($("#addParentId").val() == "") {
openmsgdialog("请先选择一个上级节点");
}
else {
$('#dialogAdd').dialog('open');
}
});
$("#mod").click(function(){//修改
if ($("#modId").val() == "") {
openmsgdialog("请选择一个关键词");
}
else
if ($("#modId").val() == 1) {
openmsgdialog("顶层节点不能修改");
}
else {
$('#dialogMod').dialog('open');//打开修改对话框
}
});
$("#del").click(function(){//删除
if ($("#delId").val() == "") {
openmsgdialog("请选择一个关键词");
}
else
if ($("#delId").val() == 1) {
openmsgdialog("顶层节点不能删除");
}
else {
if (confirm("此操作不可恢复,可能导致系统崩溃,您确定删除吗?")) {
$.ajax({
url: "treedel",
type: "POST",
data: {
id: $("#delId").val()
},
success: function(msg){
if (msg.result == 1) {
$("#tree").reflash($("#delParentId").val());
}
else {
openmsgdialog(msg.errMsg);
}
},
error: function(msg){
openmsgdialog("发生未知错误");
}
});
}
}
});
$("#dialogAdd").dialog('destroy');
$('#dialogAdd').dialog({//添加的对话框
autoOpen: false,
width: 200,
height: 300,
modal: true,
buttons: {
'取消': function(){
$(this).dialog('close');
},
'新增': function(){
var text = $('#addName'), value = $('#addSynonyms'), thesParentId = $('#addParentId')
var tips = $("#dialogAdd .validateTipsl");
var bValid = true;
bValid = bValid && checkNotNull(text, "关键词名不能为空", tips);
if (bValid) {
$.ajax({
url: "treeadd",
type: "POST",
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
data: {
text: text.val(),
value: value.val(),
thesParentId: thesParentId.val()
},
success: function(msg){
if (msg.result == 1) {
$("#tree").reflash($("#addParentId").val());
$('#dialogAdd').dialog('close');
}
else {
updateTips(msg.errMsg, tips);
}
if(msg.fieldErrors!=null){
updateTips(msg.fieldErrors.value, tips);
}
},
error: function(msg){
updateTips("发生未知异常", tips);
}
});
}
}
},
close: function(){
$('#dialogAdd form')[0].reset();
$("#dialogAdd").children().removeClass("ui-state-error");
$("#dialogAdd .validateTipsl").text("");
}
})
autoFillSingle($("#search-keywords"));//?
$("#tabs").tabs();//?
});
function load(){
$("input").val("");//设定文本框的值
//autoFill($("#search-keywords"));
o = {
url: "treeview",//请求ThesMgrAction的treeview方法
selectnode: function(id, name, value, parentId){
$("#addParentId").val(id), $("#modId").val(id), $("#modName").val(name), $("#modSynonyms").val(value), $("#modParentId").val(parentId), $("#delId").val(id), $("#delParentId").val(parentId)
}//获得当前值
};
$.ajax({
url: o.url,
type: "POST",//请求方式
async: false,//同步请求
data: { //发送到服务器的数据
id: 0
},
success: function(treedata){
o.data = treedata;
}
});
$("#tree").treeview(o);//?
$("#add").click(function(){//添加
if ($("#addParentId").val() == "") {
openmsgdialog("请先选择一个上级节点");
}
else {
$('#dialogAdd').dialog('open');
}
});
$("#mod").click(function(){//修改
if ($("#modId").val() == "") {
openmsgdialog("请选择一个关键词");
}
else
if ($("#modId").val() == 1) {
openmsgdialog("顶层节点不能修改");
}
else {
$('#dialogMod').dialog('open');//打开修改对话框
}
});
$("#del").click(function(){//删除
if ($("#delId").val() == "") {
openmsgdialog("请选择一个关键词");
}
else
if ($("#delId").val() == 1) {
openmsgdialog("顶层节点不能删除");
}
else {
if (confirm("此操作不可恢复,可能导致系统崩溃,您确定删除吗?")) {
$.ajax({
url: "treedel",
type: "POST",
data: {
id: $("#delId").val()
},
success: function(msg){
if (msg.result == 1) {
$("#tree").reflash($("#delParentId").val());
}
else {
openmsgdialog(msg.errMsg);
}
},
error: function(msg){
openmsgdialog("发生未知错误");
}
});
}
}
});
$("#dialogAdd").dialog('destroy');
$('#dialogAdd').dialog({//添加的对话框
autoOpen: false,
width: 200,
height: 300,
modal: true,
buttons: {
'取消': function(){
$(this).dialog('close');
},
'新增': function(){
var text = $('#addName'), value = $('#addSynonyms'), thesParentId = $('#addParentId')
var tips = $("#dialogAdd .validateTipsl");
var bValid = true;
bValid = bValid && checkNotNull(text, "关键词名不能为空", tips);
if (bValid) {
$.ajax({
url: "treeadd",
type: "POST",
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
data: {
text: text.val(),
value: value.val(),
thesParentId: thesParentId.val()
},
success: function(msg){
if (msg.result == 1) {
$("#tree").reflash($("#addParentId").val());
$('#dialogAdd').dialog('close');
}
else {
updateTips(msg.errMsg, tips);
}
if(msg.fieldErrors!=null){
updateTips(msg.fieldErrors.value, tips);
}
},
error: function(msg){
updateTips("发生未知异常", tips);
}
});
}
}
},
close: function(){
$('#dialogAdd form')[0].reset();
$("#dialogAdd").children().removeClass("ui-state-error");
$("#dialogAdd .validateTipsl").text("");
}
})
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货