Hi there,
I have read that to update data from multiple table, you have to edit the serverside code as stated in here docs.dhtmlx.com/doku.php?id=dhtm … operations
however I have no idea what to code or where to place the code…I have tried and still getting no result
here is the snapshot of my error page
I really have no idea what caused this error…I have tested the data processor with single table and it works for CRUD
…here is a piece of my code (btw I’m using coldfusion)
client side code
jQuery(document).ready(function() {
var myGrid = new dhtmlXGridObject("myGrid");
myGrid.setImagePath("css/imgs/");
myGrid.setHeader("Product ID, Manufacturer, Product Type, Color, Product Name, Price, Launch Date, Max Volume, Notes");
myGrid.attachHeader("#rspan,#connector_select_filter,#connector_select_filter,#rspan,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter");
myGrid.setInitWidths("50,200,200,100,250,200,200,200,500");
myGrid.setColTypes("ro,coro,coro,ra,ed,ed,ed,ed,txt");
myGrid.setColSorting("na,connector,connector,connector,connector,connector,connector,connector,connector");
myGrid.setPagingWTMode(true,true,true,[25,50,100,1000]);
myGrid.enablePaging(true, 25, 10, "pagingArea", true, "infoArea");
myGrid.setPagingSkin("toolbar","dhx_skyblue");
//myGrid.enableSmartRendering(true);
myGrid.enableMultiselect(true);
myGrid.init();
myGrid.loadXML("connector/connector.cfm");
//myGrid.load("components/loadData.cfc?method=loadGridData", "json");
var dp = new dataProcessor("connector/connector.cfm");
dp.init(myGrid);
//delete selected row
jQuery("#btnDelete").click(function(){
myGrid.deleteSelectedRows();
})
});
server side code
<cfinclude template="config.cfm">
<cfset grid = createObject("component",request.dhtmlxConnectors["grid"]).init(request.dhtmlxConnectors["datasource"],request.dhtmlxConnectors["db_type"])>
<!---
<cfset grid.enable_log(variables,getCurrentTemplatePath() & "_debug.log")>
--->
<!--- set datasource name --->
<cfset dsn="task2">
<!--- get option lists for combo box --->
<cfquery name="getProductType" datasource="#dsn#">
SELECT *
FROM tbl_productType
</cfquery>
<cfquery name="getManufacturer" datasource="#dsn#">
SELECT *
FROM tbl_manufacturer
</cfquery>
<!--- set option lists for productType --->
<cfset productType = structNew()>
<cfloop query="getProductType">
<cfset productType[#productTypeId#]="#productTypeName#">
</cfloop>
<cfset grid.set_options("productTypeId", productType)>
<!--- set option lists for manufacturer --->
<cfset manufacturer = structNew()>
<cfloop query="getManufacturer">
<cfset manufacturer[#manufacturerId#]="#manufacturerName#">
</cfloop>
<cfset grid.set_options("manufacturerId", manufacturer)>
<!--- render the table --->
<cfsavecontent variable="query">
SELECT printerId, productId, manufacturerName, productTypeName, isColor, productName, price, launchDate, maxVolume, notes
FROM tbl_printer P, tbl_manufacturer M, tbl_ProductType PT
WHERE P.manufacturerId = M.manufacturerId
AND P.productTypeId = PT.productTypeId
</cfsavecontent>
<cffunction name="colorRow">
<cfargument name="row">
<cfif ARGUMENTS.row.get_index() mod 2>
<cfset ARGUMENTS.row.set_row_color("red")>
</cfif>
</cffunction>
<cffunction name="myUpdate">
<cfargument name="action">
<cfquery name="updateManufacturer">
UPDATE tbl_printer SET manufacturerId = ARGUMENTS.action.get_data('manufacturer_Id') WHERE manufacturerId = ARGUMENTS.action.get_id();
</cfquery>
<cfset ARGUMENTS.action.success()>
</cffunction>
<cfset grid.dynamic_loading(100)>
<cfset grid.event.attach("beforeRender", colorRow)>
<cfset grid.event.attach("beforeUpdate", myUpdate)>
<cfset grid.render_sql(#query#, "printerId", "productId,manufacturerName,productTypeName,isColor,productName,price,launchDate,maxVolume,notes")>
any kind of help is appreciated…thanks in advance