Custom serverside PHP update

Hi all,

this is my serverside-file:

[code]<?php
require ‘custom.php’;
require ‘codebase/grid_connector.php’;
$a = new CustomConn();
$a->initDB();
$gridConn = new GridConnector($a->db,“MySQL”);
$gridConn->event->attach(“beforeUpdate”,“my_update”);
function my_update($data){

  }

$b=$a->getOutput();
header(“Content-type: text/xml”);
echo(“<?xml version='1.0' encoding='utf-8' ?>”).$b;
?>[/code]

With this code, my grid is showed perfectly, the “getOutput” generates custom made XML-code.
BUT, how do I save changes in the grid?
I’m stuck in the my_update function. Do I need this function? Is this the right way?
I need to know what fields are updated so I can write a custom query…

tx!!!

The client side seems to work. When a field is edited, it’s bold. Under the grid, there is an update button, but when I click this button, it says “incorrect xml”…

the grid loads perfectly, and I get no error when i click update without changing a cell…

What’s wrong?

Yep, the beforeUpdate is the correct way.
This function will receive action object with values of all fields
docs.dhtmlx.com/doku.php?id=dhtm … ex_updates

Also, in case of connector usage - you must exec $gridConn->render_sql or $gridConn->render_table command to activate the connector.

If you wish to use custom code , you can take all parameters directly from request, without using connectors at all.

docs.dhtmlx.com/doku.php?id=dhtm … rocessor&s[]=dataprocessor#data_sending_modes

I already read those samples and manuals…

I can’t figure out how to make this work…

f.e., if my fully custom code needs to do nothing, the myupdate function needs to be empty (like now), but I get a xml-error now, when I click update… WHY??

tx for helping me

If you still have a problems with connectors you an try to use the fully custom solution.
Just use the custom php script as target for dataprocessor - example of such custom script is attached.
update_all.zip (1.31 KB)

I still can’t find how to make it work…

This is what I’m looking for:

I have a php class with a function that returns a string with the xml to show
I want to make another functin in this class that handles the incoming changes of the grid.

My only question is, how do I make this (client and serverside)?

Does someone PLEASE have an example of this? I’m trying to solve this for weeks now :s

Check the code of previously attached update.php

Code need to do the next
a) check if POST[‘ids’] present, if this parameter exists - we are in update mode
b) split ids, and get $POST[$rowId."!nativeeditor_status"] - it contains the name of operation - based on it you need exec create, update or delete logic

The update.php from previous sample is fully functional update script without any external dependencies ( config.php - just creates a db connection )

I still can’t find how to make this work…

I will not use insert or delete, only update.
My rows in the grid are not the same as the rows in the table (but I found a way to solve this) ->

I build my own xml-string that is showed with “echo” in the php-file.

BUT I cannot find how to update this grid. When I click “update”, it always says “wrong xml…”.

Can you help me (again) please?

BUT I cannot find how to update this grid. When I click “update”, it always says “wrong xml…”.
Response for update operation must be an XML as well

docs.dhtmlx.com/doku.php?id=dhtm … rocessor&s[]=dataprocessor#adjusting_server_side_code

Yes, I know, but how do I make this work? In your code, do you respond xml? where? how?

tx

In the end of previously provided update.php you can find something like

echo "<data>"; echo "<action type='".$action."' sid='".$rowId."' tid='".$newId."'/>"; echo "</data>";

And what does this mean? Can you explain this part?
Do I only have to do this? Or does it need the whole xml like when it opens on start?

tx!

After executing update|insert|delete operation script must return such xml response.

docs.dhtmlx.com/doku.php?id=dhtm … principles

Ok,

after weeks and weeks of trying i’m NOT able to make this work.

Can someone PLEASE (!) give me a working example?

f.e.:
index.php -> with the grid
xml.php -> with a custom xml-generator
update.php -> THIS IS THE MOST IMPORTANT!!

Sorry, but i hope someone will help me… Giving links is not a solution, I’m still not able to make it work!!!

please??

tx!

please?

really nobody? please help me with a full working example :s

Come on please, is it so hard to help me with this? When I use a custom one, I always get an xml-error when trying to update the grid. PLEASE support!!

I don’t understand either why there are no clear insert/update/delete samples for forms/grids, etc. with php/MySQL target in the documentation. Everyting needs to be searched together and at end it’s not working.

Would take them only a few hours to place such samples in the documentation.

Grid
docs.dhtmlx.com/doku.php?id=dhtm … aprocessor

Form
docs.dhtmlx.com/doku.php?id=dhtm … orm_server

a) init dataprocessor on client side
b) init connector on server side

Connector packages contains about 40 samples for different components and scenarios.

If you don’t want to use connectors both form and grid support native form-like data saving, which you can use with any custom server side code

docs.dhtmlx.com/doku.php?id=dhtm … ntegration
dhtmlx.com/docs/products/dhtmlxG … _form.html

Ok,

I finally got the grid working! :mrgreen:

Now there is still one problem: The $_POST array includes all columns of the updated row, but I only want to have the updated columns. How can I do this?

tx!