Here is my js
[code]function doOnLoad() {
var layout, menu, toolbar;
dhtmlx.image_path = “codebase/imgs/”;
$.getJSON('common/json.config.php?setup=custLayout', function (data) {
//noinspection JSPotentiallyInvalidConstructorUsage
layout = new dhtmlXLayoutObject(document.body, "2E"); //initializes dhtmlxLayout
if (data[0].objPattern == "2E") {
layout.cells("a").setText(data[0].cellText); //sets the text in the header of the 'grid' column
layout.cells("b").setText(data[0].cellText_2); //sets the text in the header of the 'form' column
layout.cells("b").setHeight(200); //sets the height of the 'form' column
} else {
layout.cells("a").setText(data[0].cellText); //sets the text in the header of the 'grid' column
}
$.getJSON('common/json.config.php?setup=menu', function (data) {
menu = layout.attachMenu(); //initializes dhtmlxMenu
menu.setIconsPath(data[0].objIconPath); //sets the path to custom icons
menu.loadStruct('data/' + data[0].objXML); //loads items from the "data/menu.xml" file to the menu
$.getJSON('common/json.config.php?setup=custGridToolbar', function (data) {
toolbar = layout.attachToolbar(); //initializes dhtmlxToolbar
toolbar.setIconsPath(data[0].objIconPath); //sets the path to custom images
toolbar.loadStruct('data/toolbar.xml'); //loads items from the "data/toolbar.xml" file to the toolbar
$.getJSON('common/json.config.php?setup=grid', function (data) {
var grid = layout.cells("a").attachGrid(); //initializes dhtmlxGrid
grid.init(); //renders dhtmlxGrid on the page
grid.load('data/' + data[0].objXML); //loads data from the "/data/" to the grid
var userForm = layout.cells("b").attachForm(); //initializes dhtmlxForm
userForm.loadStruct('data/form.xml'); //loads controls, specified in the "data/form.php" file to the form
userForm.bind(grid); //binds the form to the grid
//noinspection JSPotentiallyInvalidConstructorUsage
var dpg = new dataProcessor("data/customers.php"); //inits dataProcessor
dpg.init(grid); //associates the dataProcessor instance with the grid
dpg.attachEvent("onAfterUpdate", function (sid, action, tid, tag) {
if (action == "inserted") {
grid.selectRowById(tid); //selects a row
userForm.setFocusOnFirstActive(); //sets focus to the 1st form's input
}
});
userForm.attachEvent("onButtonClick", function (id) { //attaches a handler function to the "onButtonClick" event
userForm.save(); //sends the values of the updated row to the server
});
toolbar.attachEvent("onclick", function (id) { //attaches a handler function to the "onclick" event
if (id == "newContact") { //'newContact' is the id of the button in the toolbar
var rowId = grid.uid(); //generates an unique id
var pos = grid.getRowsNum(); //gets the number of rows in the grid
grid.addRow(rowId, ["", "", ""], pos); //adds a new row to the grid. The 'addRow()' method takes 3 parameters: the row id (must be unique), the initial values of the row, the position where the new must be inserted
}
if (id == "delContact") { //'delContact' is the id of the button in the toolbar
rowId = grid.getSelectedRowId(); //gets the id of the currently selected row
var rowIndex = grid.getRowIndex(rowId); //gets the index of the row with the specified id
if (rowId != null) {
grid.deleteRow(rowId); //deletes the currently selected row
if (rowIndex != (grid.getRowsNum() - 1)) { //checks whether the currently selected row is NOT last in the grid
grid.selectRow(rowIndex + 1, true); //if the currently selected row isn't last - moves selection to the next row
} else { //otherwise, moves selection to the previous row
grid.selectRow(rowIndex - 1, true)
}
}
}
});//- grid
});//- custGridToolbar
});//- menu
});
}); //- layout
} //- doOnLoad
dhtmlxEvent(window, ‘load’, doOnLoad);[/code]
And here is my HTML
[code]<?php session_start();
if ((isset($_SESSION[‘Logged’]) && $_SESSION[‘Logged’] = 1)) {} else { header(“Location: login.php”); }
?>
<script src="codebase/dhtmlx.js" type="text/javascript"></script>
<script src="codebase/connector/connector.js" type="text/javascript"></script>
<script src="common/js/jquery.min.js" type="text/javascript"></script>
<script src="common/js/load.js" type="text/javascript"></script>
[/code]
When im with this exact code, i get Uncaught TypeError: undefined is not a function for userForm.bind(grid); cause it conflicts with Jquery.
When i remove Jquery include, i get Uncaught ReferenceError: $ is not defined cause i got $.getJSON in my javascript code to load the structure variables dynamically from the db.
Any suggestions about the conflict ? or how to fix .bind