DataProcessor error

Hi,

I am using version 3.5 of the free suite. I have a dataview component connected to the db using dataprocessor. On the client side it goes like this:

[code] dataX0 = new dhtmlXDataView({
container: “data_container_X0”,
type: {
template: “

#EXPORT_TEMPLATE_TABLE_COMMENT#
#EXPORT_TEMPLATE_COLUMN_COMMENT#
#EXPORT_TEMPLATE_TABLE_NAME#
#EXPORT_TEMPLATE_COLUMN_NAME#
”,
height: 48,
width:175
},
x_count: 5,
y_count: 2
});

dpDataX = new dataProcessor( "dataX.php" );
dpDataX.init( dataX );
dpDataX.setTransactionMode("GET", false);[/code]

and on the server side (dataX.php):

[code] require_once( “…/codebase/connector/dataview_connector.php” );
require_once( ‘…/config.php’ );
error_reporting(E_ALL ^ E_NOTICE);

$conn = mysql_connect( $server, $user, $pass );
mysql_select_db( $db_name );

$data = new DataViewConnector( $conn, "MySQL" );
$data->enable_log("log.txt",true);
$data->set_encoding("utf-8");
$data->render_table( "0_export_templates", "EXPORT_TEMPLATE_IDX", "EXPORT_TEMPLATE_TABLE_NAME, EXPORT_TEMPLATE_TABLE_COMMENT, EXPORT_TEMPLATE_COLUMN_NAME, EXPORT_TEMPLATE_COLUMN_COMMENT" );[/code]

After I drag a new element to the dataX view, the database is not updated, the log.txt shows error message:

[code]

Log started, 08/09/2012 08:34:58

SELECT EXPORT_TEMPLATE_IDX,EXPORT_TEMPLATE_TABLE_NAME,EXPORT_TEMPLATE_TABLE_COMMENT,EXPORT_TEMPLATE_COLUMN_NAME,EXPORT_TEMPLATE_COLUMN_COMMENT FROM 0_export_templates

Undefined variable: start at C:\www\codebase\connector\dataview_connector.php line 63

Done in 0.016530990600586s[/code]

while the debug window shows the parameters are null and the response is empty xml file

[code] Log:
row 1347086088015 marked [inserted,valid]
Initiating data sending for 1347086088015
Sending in one-by-one mode, current ID = 1347086088015
Server url: dataX.php parameters

null

Server response received details

<?xml version='1.0' encoding='utf-8' ?><data></data>[/code]

What am I doing wrong here?

As you are using non-standard mode

   dpDataX.setTransactionMode("GET", false);

Connector will not be able to detect update command. To work, it must be set as

   dpDataX.setTransactionMode("POST", true);

Also be sure that connector.js is included on the page.

Stanislav, as always you’re the one who saves the day :slight_smile:

It was connector.js missing from the include list and the transaction mode set inproperly. After corrrecting the code and including connecter.js the changes save to to db.

However, I still cannot do what I need.

I must block saving the changes triggered by drag and drop actions and send all the data at once manually (after click on “Save” button). I figured I’d need “onBeforeDataSending” event in order to block the default behaviour. But it appears that dpDataX.sendData() does not trigger the mentioned event at all. Nor it sends the data via dataProcessor.

Or maybe I’m doing this all wrong again?

Try to use

dp.setUpdateMode("off"); 

will block auto-sending, so data will be sent only when you trigger it manually by dp.sendData();
Also, you can use

dp.setUpdateMode("off", true); 

this mode is similar to above one, but it process dnd actions differently. Normally dnd in the component is processed as combination of insert|delete operations. But this above command it will be processed as single “update”

Lovely, dp.setUpdateMode(“off”) did the trick! I can’t believe it was so simple :slight_smile:

Thank you one more time Stanislav! I do hope I should be ready for deployment of my app soon so I can place an order for the pro version and support you guys.

Many thanks again!

Thanks for the assists! I was stuck with my code for the same reason, thanks for clarifying