Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by AAM on Dec 09, 2009 18:11
open dhtmlx forum
dhtmlx is not defined

I have a problem with no draw in explorer, but in firefox i see the container, get this errror in console errors of firefox

Error: dhtmlx is not defined
Archivo de origen: http://localhost/mapi/js/dhtmlxWindows/codebase/dhtmlxwindows.js
Línea: 69

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.host]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: XPCSafeJSObjectWrapper.cpp :: anonymous :: line 450" data: no]

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.host]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: XPCSafeJSObjectWrapper.cpp :: anonymous :: line 450" data: no]

my code a javascript

var dhxWins,
toolbar,
statusBar,
grid,
wins,
menu,
layout;

var tabla ="",
operacion="";

var campos = "",
columnas=0;

var campos2 = "",
columnas2=0;

var skin = "dhx_black";

const ALTA = 1;
const ACTUALIZA = 2;
const BORRA = 3;

/****************************
* Coloca el skin
*****************************/
function setSkin(skinInterface){
skin = skinInterface;
}

/****************************
* Inicializa entorno
*****************************/
function init() {
doWindow();
doMenu();
    doToolBar();
    doStatusBar();
}

/****************************************************************
* Inicializa contenedor
****************************************************************/
function doWindow(){
dhxWins = new dhtmlXWindows();
    dhxWins.enableAutoViewport(true);
    dhxWins.attachViewportTo("ventana");
    dhxWins.setImagePath("../js/dhtmlxWindows/codebase/imgs/");
    wins = new Array();
    wins = dhxWins.createWindow("main", 0, 0, 900, 500);
    wins.button("close").disable();
    wins.setText(getTitulo());
    wins.clearIcon();
    dhxWins.window("main").center();
    dhxWins.window("main").setModal(true);
    dhxWins.setSkin(skin);
}

/***************************************************************
* Inicializa menu
***************************************************************/
function doMenu(){
menu = wins.attachMenu();
menu.attachEvent("onClick", menuClick);
menu.setImagePath("../js/dhtmlxMenu/codebase/imgs/");
menu.setIconsPath("../js/dhtmlxMenu/common/imgs/");
if (skin=="dhx_skyblue")
menu.setSkin("dhx_blue");
else
menu.setSkin(skin);
menu.loadXML("xml/menu.xml");
layout = new dhtmlXLayoutObject(wins, "1C");
layout.items[0].setText("");
}

/***************************************************************
* Inicializa tool bar
***************************************************************/
function doToolBar(){
toolbar = layout.cells("a").attachToolbar();
toolbar.setIconsPath("../js/dhtmlxToolbar/common/imgs/");
toolbar.setSkin(skin);
toolbar.attachEvent("onClick",function(id){toolBarClick(id);});
toolbar.loadXML("xml/toolbar.xml?etc=" + new Date().getTime());
}

/***************************************************************
* Inicializa status bar
***************************************************************/
function doStatusBar(){
statusBar = layout.cells("a").attachStatusBar();
setStatusBar("");
}

/***************************************************************
* Eventos del menu
***************************************************************/
function menuClick(id) {
tabla = id;
switch(id){
case "cerrar":
parent.self.location = "cierra_session.php";
break;
default:
setConsulta(id);
break;
}
}

/***************************************************************
* Eventos de tool bar
***************************************************************/
function toolBarClick(id) {
operacion = id;
if(tabla!=""){
switch(operacion){
case "nuevo":
setForm(tabla);
break;
case "guardar":
setForm(tabla);
break;
case "consultar":
setConsulta(tabla);
break;
default:
alert(tabla + " " +operacion);
break;
}
}else{
alert("Debe elegir alguna opcion del menu");
}
}

/***************************************************************
* Dibuja la forma para altas de registros
***************************************************************/
function setForm(id){
var forma = "";
switch (id) {
case 'empresas':
forma = "catalogos/empresas.php";
break;
case 'usuarios':
forma = "catalogos/usuarios.php";
break;        
case 'proyectos':
forma = "proyectos/proyectos.php";
break;                    
case 'upload':
forma = "proyectos/subir_doc.php";
break;                                
default:
break;
}
    if(id!='')
     layout.cells("a").attachURL(forma);
}

/***************************************************************
* Dibuja la forma para editar registros
***************************************************************/
function setEditForm(id, params){
var forma = "";
switch (id) {
case 'empresas':        
forma = "catalogos/empresas.php?operacion="+ACTUALIZA+"&"+params;
layout.cells("a").attachURL(forma);
break;
case 'usuarios':        
forma = "catalogos/usuarios.php?operacion="+ACTUALIZA+"&"+params;
layout.cells("a").attachURL(forma);
break;            
case 'proyectos':        
forma = "proyectos/proyectos.php?operacion="+ACTUALIZA+"&"+params;
layout.cells("a").attachURL(forma);
break;        
case 'documentos':        
forma = "proyectos/get.php?"+params;
layout.cells("a").attachURL(forma);
break;                    
default:
break;
}

}

function deleteRegistro(id, params){
var forma = "";
switch (id) {
case 'documentos':            
            forma = "proyectos/documento_operacion.php?operacion="+BORRA+"&"+params;
            layout.cells("a").attachURL(forma);    
            break;
        default:
            break;
    }
}

/***************************************************************
* Coloca mensaje en el status bar
***************************************************************/
function setStatusBar(texto){
statusBar.setText(texto);
}

/***************************************************************
* Cambia skin
***************************************************************/
function changeSkin(obj) {
skin = obj;
}

/***************************************************************
* Evento de edicion del grid
***************************************************************/
function doOnCellEdit(stage,rowId,cellInd){
var parametros = "";
for(i=1; i<=columnas; i++){
parametros += campos[i-1] + "="+ grid.cells(rowId,i-1).getValue();
        if (i<columnas)
parametros +="&";
}
setEditForm(tabla, parametros);
}

/***************************************************************
* Consultas
***************************************************************/
function setConsulta(id){
switch (id) {
        case "empresas":
layout.items[0].setText(menu.getItemText(id));
layout.cells("a").attachURL(menu.getUserData(id, "data"));
doGridEmpresas();
grid.enableSmartRendering(true, 50);
setStatusBar("Empresas");
            break;
        case "usuarios":
layout.items[0].setText(menu.getItemText(id));
layout.cells("a").attachURL(menu.getUserData(id, "data"));
doGridUsuarios();
grid.enableSmartRendering(true, 50);
setStatusBar("Usuarios");
            break;            
        case "estados":
layout.items[0].setText(menu.getItemText(id));
layout.cells("a").attachURL(menu.getUserData(id, "data"));
doGridEstados();
grid.enableSmartRendering(true, 50);
setStatusBar("Estados");
            break;                        
        case "proyectos":
layout.items[0].setText(menu.getItemText(id));
layout.cells("a").attachURL(menu.getUserData(id, "data"));
doGridProyectos();
grid.enableSmartRendering(true, 50);
setStatusBar("Proyectos");
            break;                                    
        case "upload":
layout.items[0].setText(menu.getItemText(id));
layout.cells("a").attachURL(menu.getUserData(id, "data"));
doGridDocumentos();
grid.enableSmartRendering(true, 50);
setStatusBar("Documentos");
            break;                                                
default:
layout.items[0].setText(menu.getItemText(id));
//doGrid();
setStatusBar("Captura de datos");
break;
}
}

/***************************************************************
* Dibuja grid de empresas
***************************************************************/
function doGridEmpresas(){
grid = layout.cells("a").attachGrid();
grid.setImagePath("../../js/dhtmlxGrid/codebase/imgs/");
grid.setHeader("ID,RAZON SOCIAL,ESTATUS,CALLE,COLONIA,CP,ESTADO");
grid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
grid.setInitWidths("60,200,60,200,100,60,200");
grid.setColTypes("link,ed,ed,ed,ed,ed,ed,ed");
grid.setColAlign("right,left,center,left,left,left,left");
grid.setColSorting("int,str,str,str,str,str,int");
columnas = 1;
campos = ["emp_id_empresa"];
grid.setSkin(skin);
grid.enableEditEvents(false,false,false);
grid.init();
grid.loadXML("xml/empresas_xml.php");
//    grid.loadXML("http://www.mapiqro.com.mx/admin/xml/empresas_xml.php");
//    grid.loadXML("../admin/xml/empresas_xml.php");
}

/***************************************************************
* Dibuja grid de Usuarios
***************************************************************/
function doGridUsuarios(){
grid = layout.cells("a").attachGrid();
grid.setImagePath("../../js/dhtmlxGrid/codebase/imgs/");
grid.setHeader("ID,RAZON SOCIAL,USERNAME,NOMBRE,APELLIDOS,ROL,ESTATUS");
grid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
grid.setInitWidths("60,200,100,100,200,100,50");
grid.setColTypes("link,ed,ed,ed,ed,ed,ed,ed");
grid.setColAlign("right,left,left,left,left,left,left");
grid.setColSorting("int,str,str,int,str,int,str");
columnas = 1;
campos = ["usu_id_usuario"];
grid.setSkin(skin);
grid.enableEditEvents(false,false,false);
grid.init();
grid.loadXML("xml/usuarios_xml.php");
}

/***************************************************************
* Dibuja grid de Estados
***************************************************************/
function doGridEstados(){
grid = layout.cells("a").attachGrid();
grid.setImagePath("../../js/dhtmlxGrid/codebase/imgs/");
grid.setHeader("ID,ESTADOS");
grid.attachHeader("#text_filter,#text_filter");
grid.setInitWidths("100,200");
grid.setColTypes("ed,ed");
grid.setColAlign("right,left");
grid.setColSorting("int,str");
columnas = 1;
campos = ["edo_id_estado"];
grid.setSkin(skin);
grid.enableEditEvents(false,false,false);
grid.init();
grid.loadXML("xml/estados.php");
}

/***************************************************************
* Dibuja grid de Estados
***************************************************************/
function doGridProyectos(){
grid = layout.cells("a").attachGrid();
grid.setImagePath("../../js/dhtmlxGrid/codebase/imgs/");
grid.setHeader("ID,RAZON SOCIAL,NOMBRE DEL PROYECTO,FECHA INICIO,FECHA ENTREGA");
grid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
grid.setInitWidths("100,200,200,100,100");
grid.setColTypes("link,ed,ed,ed,ed");
grid.setColAlign("right,left,left,left,left");
grid.setColSorting("int,str,str,str,str");
columnas = 1;
campos = ["pry_id_proyecto"];
grid.setSkin(skin);
grid.enableEditEvents(false,false,false);
grid.init();
grid.loadXML("xml/proyectos_xml.php");
}

/***************************************************************
* Dibuja grid de Documentos
***************************************************************/
function doGridDocumentos(){
grid = layout.cells("a").attachGrid();
grid.setImagePath("../../js/dhtmlxGrid/codebase/imgs/");
grid.setHeader("ID,RAZON SOCIAL,NOMBRE DEL PROYECTO,DESCRIPCION, BORRAR");
grid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
grid.setInitWidths("100,200,200,200,100");
grid.setColTypes("link,ed,ed,ed,link");
grid.setColAlign("right,left,left,left,center");
grid.setColSorting("int,str,str,str,int");
columnas = 1;
campos = ["doc_id_documento"];
grid.setSkin(skin);
grid.enableEditEvents(false,false,false);
grid.init();
grid.loadXML("xml/documentos_xml.php");
}




Answer posted by Alex (support) on Dec 10, 2009 02:05
The issue looks like you don't use the latest dhtmlxcommon.js. Please, check that you use dhtmlxcommon.js from 2.5 package and this file is correctly included.
Answer posted by AAM on Dec 13, 2009 21:33
Thanks,
i find error, was the constants iexplorer not accepted.