0
我正在使用动态值为首先选中&打开它是checked_id。在checked_id,我已经指派'"skillTree_1576","skillTree_1573"'
价值,但它不工作...如果同样的值i静态传递那么它的做工精细....下面是源代码如何获取jstree中的选定节点?
$("#"+node_id+"Edit").live("click", function(){
$('#'+node_id+'Lookup').show();
$('#'+node_id+'Values').hide();
$("#"+node_id).bind("check_node.jstree", function (e, data) {//check all parent nodes
var currentNode = data.rslt.obj.attr("id");
var parentNode = data.rslt.obj.attr("parent_id");
$("#"+node_id).jstree("check_node", "#"+parentNode);
}).bind("uncheck_node.jstree", function (e, data) {//uncheck all child nodes
var currentNode = data.rslt.obj.attr("id");
var allChildNodes = data.inst._get_children(data.rslt.obj);
allChildNodes.each(function(idx, listItem) {
var nid = $(listItem).attr("id");
$("#"+node_id).jstree("uncheck_node", "#" + nid);
});
}).jstree({"0":"","plugins":["themes","json_data","ui","search","hotkeys","checkbox"],"checkbox":{
"real_checkboxes":true,"two_state":true,"checked_parent_open":true,"override_ui":true
},"themes":{"theme":"classic","dots":true,"icons":false},"json_data":{
"ajax":{"url":baseUrl+url,"data":function (n) {
return {'node_name': node_id, 'operation' : 'lookup_children', 'id' : n.attr ? n.attr('id').replace(/[a-z0-9A-Z]+_/g,'') : 0 };
$('#'+node_id+'emptySearch').hide(); },"success":function(){}}},"search":{
"show_only_matches":false,"ajax":{
"url":baseUrl+url,"data":function (str) {if(str.length > 2) {
return {'node_name': node_id, 'operation' : 'search', 'search_str' : str}; } },"success":function (data) {
if(data.length == 0) { $('#'+node_id+'emptySearch').show();
} else {
$('#'+node_id+'emptySearch').hide();}}}},"ui":{"initially_select":[checked_id] },"core":{
"initially_open":[checked_id],"load_open":true,"open_parents":true}});
// alert ('hello : '+checked_id);
});
如果任何人有这个问题不清楚,请帮助我..谢谢提前
在jstree有多个选择项,其被称为initially_select ..如果我在这个领域通过静态值其工作正常,但如果我通过可变cheked_id它不工作...所以,我想如何我可以解决这个问题吗? –
@ratneshdwivedi如果你设置小提琴然后我会帮助。 – Amit