Hi
I have a script using the accordion with a few combos in it and a database to xml data.
The problem is when I send reorder and accordion combo stops working.
I use the “destruct” that erases all content to be created again.
But I realized that not all content is really deleted and this must be the source of errors in combos.
Will some bug in this function with “destruct”?
Is there any other way to delete all components of the accordion, including combos and start the reordering?
Please excuse my English.
I accept any idea.
Thanks.
Rafael
dhtmlx v. 2.6
script:
function ordena_lista(value,fn){ //(fn is the function start_reset)
if(fn() == true){
var dir_local = document.getElementsByName(“dir_local”);
var dir_local_fotos = document.getElementsByName(“dir_local_fotos”);
var rand_videos = document.getElementsByName(“rand_videos”);
var limit_videos = document.getElementsByName(“limit_videos”);
var params = “dir_local=”+dir_local[0].value+“&dir_local_fotos=”+dir_local_fotos[0].value
+“&limit_videos=”+limit_videos[0].value+“&ord=”+value;
ajaxHTML(“url_load”,“xml/importacao/xml_importacao.php”,response_url_importacao,"Erro ao processar
XML.",params);
}
}
function start_reset(){
v.length = 0;
obj_id_acc.length = null;
obj_id_acc = new Array();
if(typeof(obj_tags) == “object”){
listagem_videos.forEachItem(function(item){
var id = item.getId();
obj_tags[id].destructor();
deleteItem(id);
});
}
fila_cmp.length = 0;
obj_id_video.length = null;
obj_id_video = new Array();
fila_cmp = new Array();
ifila_cmp = 0;
obj_tags.length = 0;
obj_tags = new Array();
incremento_imp = 0;
altura = 417;
mygrid.clearAll();
contador_linhas=0;
menu_load_exit = true;
listagem_videos.unload();
deletar_html_dinamico();
return true;
}
function deletar_html_dinamico(){
pai = document.getElementById(“conf_videos”);
if (pai.childNodes.length != 0){
elem = pai.childNodes[pai.childNodes.length-1];
elem.removeNode(true);
}
}
function deleteItem(id){
listagem_videos.cells(id).hide();
delete listagem_videos.idPull[id];
}
function painel_configs(i,j,id_video,qtd_img,titulo,imagem,tempo,data_time,id_url,conf_videos){
if(document.getElementById(“tags_”+i+j) != undefined){ //(this “if” tests if the div is there and says that was not erased. It should have been deleted in the function start_reset(fn))
alert(“existe”);
}
conf_videos.innerHTML += ‘<div ID="list_’+i+j+'" class=“txt_ajuda” style="position: relative; width: 97%;
height: 406px; overflow: auto; display: inline; margin: 0px 0px 0px 0px; text-align: justify;“>‘+
‘
‘<img ID="v_’+id_video+’” src=“‘+imagem+’” NAME=“foto_‘+id_video+’” class=“thumb_import” onmouseout="endm
('‘+id_video+’')" onmouseover=“startm('‘+id_video+’','‘+qtd_img+’',''+imagem.replace(“0.JPG”,”")+'',
'.JPG','v_')" alt=“‘+titulo+’”/>
‘
‘
‘
‘
‘
‘
‘
‘
Onclick=“txt_ajuda('categorias')” onchange=“load_tags(this.value,‘+id_video+’)”>‘+
‘Lista de Categorias’+
‘’+
‘
‘<input ID="titulo_’+i+j+’" class=“titulo_import” type=“text” NAME=“titulo_‘+i+j+’” maxlength=“200”
value=“‘+titulo+’” Onclick=“txt_ajuda('titulo_video')”>
‘
‘<textarea ID="obs_’+i+j+’" class=“desc_import” NAME=“descricao_‘+i+j+’” Onclick="txt_ajuda('desc_video
')“>‘+
‘
‘
‘
‘<input class=“txt_mercadoria txt_100” type=“text” name="dt_agendamento_’+i+j+’” maxlength=“10”
onkeypress=“return dateMask(this, event);” Onclick=“txt_ajuda('dt_agendamento')” />'+
'<a href=“javascript:void(0)” onclick="if(self.gfPop)gfPop.fPopCalendar
(document.importacao.dt_agendamento_‘+i+j+’);return false;" hidefocus>'+
'<img name=“popcal” class=“btn_calendario” align=“absmiddle” src=“WeekPicker/calbtn.gif” alt="Data do
Agendamento" />
filter[i][j]= titulo;
listagem_videos.addItem(“c_”+i+j,titulo);
listagem_videos.cells(“c_”+i+j).attachObject(“list_”+i+j);
listagem_videos.setIcon(“c_”+i+j, ‘img/sistema/importacao/ico_video.gif’);
object_listagem[id_video] = “c_”+i+j;
hide_array[i][j] = 1;
altura = altura + 25;
document.getElementById(“listagem_videos”).style.height = altura+“px”;
insert_fila_cmps(j,i,id_video,titulo,id_url);
}
function create_cmps(){
var idlogin = document.getElementsByName(“idlogin”);
var dir_local = document.getElementsByName(“dir_local”);
var dir_local_fotos = document.getElementsByName(“dir_local_fotos”);
if(menu_load_exit == true && (ifila_cmp < fila_cmp.length)){
menu_load_exit = false;
listagem_videos.cells(“c_”+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0]).open();
menu_videos[fila_cmp[ifila_cmp][1]] = new Array();
menu_videos[fila_cmp[ifila_cmp][1]][fila_cmp[ifila_cmp][0]] = listagem_videos.cells(“c_”+fila_cmp
[ifila_cmp][1]+fila_cmp[ifila_cmp][0]).attachMenu();
menu_videos[fila_cmp[ifila_cmp][1]][fila_cmp[ifila_cmp][0]].setIconsPath(‘img/dhxmenu_dhx_skyblue/’);
menu_videos[fila_cmp[ifila_cmp][1]][fila_cmp[ifila_cmp][0]].attachEvent(“onClick”, menuClick);
menu_videos[fila_cmp[ifila_cmp][1]][fila_cmp[ifila_cmp][0]].loadXML('xml/importacao/xml_create_menu.php?
idvideo=‘+fila_cmp[ifila_cmp][2]+’&titulo=‘+url_encode(fila_cmp[ifila_cmp][3])+’&id_url='+fila_cmp[ifila_cmp]
[4]+‘&incremento_imp=’+fila_cmp[ifila_cmp][1]+‘&j=’+fila_cmp[ifila_cmp][0]+‘&idlogin=’+idlogin[0].value
+‘&dir_local=’+url_encode(dir_local[0].value)+‘&dir_local_fotos=’+url_encode(dir_local_fotos
[0].value),function(){
v[fila_cmp[ifila_cmp][2]] = menu_videos[fila_cmp[ifila_cmp][1]][fila_cmp[ifila_cmp][0]];
obj_tags[“c_”+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0]] = new dhtmlXCombo(‘tags_’+fila_cmp
[ifila_cmp][1]+fila_cmp[ifila_cmp][0], ‘alfa_’+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0], ‘230’,
‘checkbox’);
obj_id_acc[fila_cmp[ifila_cmp][2]]= “c_”+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0];
obj_id_video[“c_”+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0]] = fila_cmp[ifila_cmp][2];
obj_tags[“c_”+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0]].attachEvent(“onOpen”, function(){
txt_ajuda(‘tags’); });
obj_tags[“c_”+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0]].attachEvent(‘onKeyPressed’,function
(KeyCode){ add_tags(KeyCode,is_ative); });
obj_tags[“c_”+fila_cmp[ifila_cmp][1]+fila_cmp[ifila_cmp][0]].attachEvent(“onCheck”, function
(value,state){ return set_checked_tags(value,state); });
menu_load_exit = true;
ifila_cmp=ifila_cmp + 1;
});
}
if(ifila_cmp<fila_cmp.length){
setTimeout(“create_cmps()”,20);
}else{
listagem_videos.cells(“c_00”).open();
ajaxHTML(“categorias”,“xml/importacao/xml_categoria.php”,response_categorias,“Erro ao processar XML.”,“”);
return “”;
}
}
function insert_fila_cmps(j,incremento_imp,id_video,titulo,id_url){
fila_cmp[fila_cmp.length]=[j,incremento_imp,id_video,titulo,id_url];
}