Node.js + express.js


#1

Hi,

I have 3.5 Pro with php dataconnector for grid. Found this description : dhtmlx.com/blog/?p=2016 . Have some questions.

  • will grid live_update module work with express ? Live update it’s related to node and I’m thinking that this will work , but want to specify …

  • now I’m getting data from php dataConnector for grid. From description about express it seems that with dataprocessor there isn’t problem , but must be created own “post”, app.post(), module, rigth ?

  • can grid work in smart rendering mode with express, like now with dataconnector for php ?

Thanks in advance !


#2

will grid live_update module work with express
Live update mode is server side agnostic. It works with any server side.
In same time the server side part of live_update solution can work with same express instance, that handles data saving logic. It will not provide any extra benefits though.

it seems that with dataprocessor there isn’t problem
Yep, the nodejs solution creates a post handler that process the data similar to the connector.

can grid work in smart rendering mode
Yes, it possible, but will requre some changes.
To use dynamic. loading with grid, data must be in xml format ( it must contain extra attributes, that can’t be configured in the json )


#3

Thanks for the answer Stanislav,

can grid work in smart rendering mode

Yes, it possible, but will requre some changes.
To use dynamic. loading with grid, data must be in xml format ( it must contain extra >attributes, that can’t be configured in the json )

So it must changed in express :

app.get(’/data’, function(req, res){
db.query(“SELECT * FROM books”, function(err, rows){
if (err) console.log(err);
res.send(rows);
});
});

As I can understand, in this place it must be created dynamic xml for returning data …

Can you post some source how to do that ?


#4

Response must look like next

<rows total_count="10000"> <row id="1"><cell>A1</cell><cell>A2</cell></row> <row id="2"><cell>A1</cell><cell>A2</cell></row> <row id="3"><cell>A1</cell><cell>A2</cell></row> </rows>

total_count - total number of records in DB
for each record in rows array you need to output row tag, values of fields go into cell subtags, id of record to row@id attribute


#5

Thanks Stanislav,

after your answer I’m thinking that this way isn’t so good as seemed … Because it must convert responce from json to xml and that can slowing data transfer. I like javascript and node + express + node-mysql let it use only javascript syntax everywhere . It worst to try convert data formats ?