Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by block on Jul 01, 2009 01:55
open dhtmlx forum
Update cell in a grid Grid using Dataprocessor passing sub_row value although setUpdateMode('cell') is selected

Hi All.

Love your product.

Have a trial version atm, but have put in the req for the commercial purchase, will be approved shortly.

I am trying to get my new grids going.

I am using ASP and msSQL server.

Samples of code and initialisation at the bottom of this text.

Trial application ##############.com Login "#####" password "#####". 
in the html string in the top of the browser change the word "ASPENv2" to read "ASPENv4" keep the rest of the HTML string the same.

Click on all open and pending in the tree....................

Notice the lovely + brings up the notes that are in the text of the XML as the sub grid elements.

When I edit a cell (Note that dp.setUpdateMode("cell") is set) it sends the following form information to the server.

(See bit 1)

Which seems to blow up my data reader on the server.

Can I tell it not to send the sub_row information?

Regards
Bruce

Bit 1
--------------
<input type="hidden" Name="gURL" value="frmJob.asp?CompanyID=42&JobID=46" />

         Name="gr_id" value="46"
Name="gTable" value="tblJobs"
Name="f:Address" value="Administration for Unisof"
Name="sub_row" value="
     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Thu 18 Jun 2009 3:09PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:johns@unisoft.com.au cc: bcc:<br>-------------------------------------------<br>Hi John.<br><br>FYI - Jobs created, closed and managed by week and by category over the pat few weeks.<br><br>Rgds<br>Bruce</div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Thu 25 Jun 2009 9:31AM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:johns@unisoft.com.au cc:Judi@unisoft.com.au;Frankie@unisoft.com.au;mitul.patel@numarasoftware.com.au;block@automatesolutions.com;techsupp@unisoft.com.au bcc:<br>-------------------------------------------<br>Hi All.<br><br>I have switched off the thing that automatically puts the client email address into the to line.<br><br>This will prevent any more accidental client emails.<br><br>Regards<br>Bruce</div>
"
Name="!nativeeditor_status" value="updated"




Grid in a layout
----------------------
//Main Grid
dhxGrid = dhxLayout.cells("b").attachGrid();
    dhxGrid.attachEvent("onRowSelect",doOnRowSelected);
    dhxGrid.setImagePath("./imgs/");
dhxGrid.init();

I am using sub rows refer to xml sample at bottom.
----------------------

I am also using a dataprocessor to update cell edits.
----------------
//Now set up the editable grid.
dp = new dataProcessor("./Engine/updGrid(test).asp?CompanyID=<%=CompanyID%>&SID=<%=session.sessionID%>")
dp.init(dhxGrid)
dp.enableDataNames(true);
dp.enablePartialDataSend(true);
dp.setUpdateMode("cell");
dp.defineAction("error", dpError);
dp.defineAction("error", dpDebug);
//specify transaction method - POST or GET (default is GET)
dp.setTransactionMode("POST");


xml sample
---------------
<rows total_count="12" pos="0">

<head>
<column type="sub_row" sort="int" width="20">E</column>
<column type="ro" sort="int" width="20">D</column>
<column type="ro" sort="int" width="100" id="f:JobID">Issue No</column>
<column type="ed" sort="str" width="*" id="f:Address">Fault</column>
<column type="ed" sort="date" width="100" id="f:MustCompleteDate">Next Date</column>
<column type="ro" sort="str" width="100" id="f:Client">Client</column>
<column type="ed" sort="str" width="100" id="f:Text1">Next Action</column>

<column type="coro" sort="str" width="100" id="r:e:Allocated">

     Rep
    
<option value="463">Tony Zdraveski</option>
<option value="464">Bruce Lock</option>
<option value="606">Mitul Patel</option>
<option value="607">Frankie Dib</option>
<option value="608">Judi Baker</option>
<option value="609">Annie Harper</option>
<option value="610">John Sestan</option>
</column>
<column type="ro" sort="str" width="100" id="f:Contact">Contact</column>
<column type="ro" sort="str" width="100" id="f:CPhone">CPhone</column>

<column type="coro" sort="str" width="100" id="stg:Stage">
Stage
    

<option value="313">New Issue</option>
<option value="314">Assigned</option>
<option value="315">Suspended</option>
<option value="316">Invoiced</option>
<option value="319">Complete</option>
</column>

<column type="coro" sort="str" width="100" id="sta:Status">
Status
    
<option value="1">Open</option>
<option value="2">Closed</option>
<option value="3">Pending</option>
</column>
<column type="ro" sort="int" width="100" id="f:Status">Inv</column>

<afterInit>

<call command="attachHeader">

<param>
,,#select_filter,#text_filter,#select_filter,#select_filter,#text_filter,#text_filter,#text_filter,#text_filter,#select_filter,#select_filter,
</param>
</call>
</afterInit>
</head>

<row id="1">
<userdata name="gURL">frmJob.asp?CompanyID=42&JobID=1</userdata>
<userdata name="gTable">tblJobs</userdata>

<cell>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Thu 14 May 2009 3:38PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    Received Machines.</div>

     <div>
     <hr>
              <span Style="Color:red">Tony Zdraveski</span>
                 <span Style="Color:DarkGreen">Thu 14 May 2009 3:45PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    <br>------------<br>From:    Annie Harper [annieh@unisoft.com.au]<br>Sent:    Wednesday, 6 May 2009 4:17 PM<br>To:    jai.narayan@2ndsworld.com.au<br>Cc:    'Frankie Dib (Frankie Dib)'; johns@unisoft.com.au; 'Mitul Patel'; chris.durlacher@2ndsworld.com.au<br>Subject:    Re: 2nds World Online- Print Plus Setup<br><br>the quote is coming... have been playing catch up from the week I was at the conference.<br>Re draft of P+ docs I would need to check- Mitul who has a hand in this was away sick for some of last week so he too is playing catch up- apologies for this.<br>cheers<br><br>Annie<br> ----- Original Message ----- <br> From: Jai Narayan <br> To: 'Annie Harper' <br> Cc: 'Frankie Dib (Frankie Dib)' ; johns@unisoft.com.au ; 'Mitul Patel' ; chris.durlacher@2ndsworld.com.au <br> Sent: Wednesday, May 06, 2009 4:09 PM<br> Subject: RE: 2nds World Online- Print Plus Setup<br><br> Hi Annie & the Team at Unisoft,<br><br> Has there been any progress or update on this work/quote/draft of P+ documents.<br><br> Please let me know.<br><br> Jai Narayan CA<br><br> Financial Controller<br><br> 2nds World Group<br><br> Ph.02-9909 0100<br><br> Mob.0414 355572<br><br> From: Annie Harper [mailto:annieh@unisoft.com.au] <br> Sent: 22 April 2009 6:26 PM<br> To: jai.narayan@2ndsworld.com.au<br> Cc: Frankie Dib (Frankie Dib); johns@unisoft.com.au; 'Mitul Patel'; chris.durlacher@2ndsworld.com.au<br> Subject: Re: 2nds World Online- Print Plus Setup<br><br> sure will do<br><br> ----- Original Message ----- <br><br> From: Jai Narayan <br><br> To: Annie Harper <br><br> Cc: Frankie Dib (Frankie Dib) ; johns@unisoft.com.au ; 'Mitul Patel' ; chris.durlacher@2ndsworld.com.au <br><br> Sent: Wednesday, April 22, 2009 4:07 PM<br><br> Subject: 2nds World Online- Print Plus Setup<br><br> <br><br> Dear Annie<br><br> <br><br> Further to my earlier emails to Alvin & Frankie, we are now getting closer to the point of getting live with our Online Website.<br><br> For this reason, we need to put into motion the configuring of a Print Plus Server and document template changes for 2nds World Online Business.<br><br> The document headers for the 2nds World Online Entity are to have only the Head Office Address, which will be the Online Base.<br><br> Frankie has already set up the Online Entity(7) & Warehouse(1) in Business Edge.<br><br> <br><br> As done in the case of Caringbah set up, I would like Unisoft to configure a PC with P+ and ship it to us.<br><br> <br><br> I am attaching a draft sketch of a typical document header and footer for the Online P+ server and will appreciate if this can be formatted and sent back for our review.<br><br> Please contact Chris Durlacher for any clarification on the wording/format of this attached document or let me know if there are any broader issues.<br><br> <br><br> We are looking at going live with 2nds World Penrith in late June early July 2009 and will be in touch about licenses and P+ setup. We will be ear marked Entity 5 ( previously 2nds World Arncliffe) for this setup.<br><br> <br><br> Please let me know the cost estimates for the job <br><br> <br><br> Jai Narayan CA<br><br> Financial Controller<br><br> 2nds World Group<br><br> Ph.02-9909 0100<br><br> Mob.0414 355572</div>

     <div>
     <hr>
              <span Style="Color:red">Tony Zdraveski</span>
                 <span Style="Color:DarkGreen">Thu 14 May 2009 3:46PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:annieh@unisoft.com.au cc: bcc:<br>-------------------------------------------<br>Received box's today.<br><br>rgds</div>

     <div>
     <hr>
              <span Style="Color:red">Tony Zdraveski</span>
                 <span Style="Color:DarkGreen">Thu 14 May 2009 3:57PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:annieh@unisoft.com.au cc:johns@unisoft.com.au bcc:<br>-------------------------------------------<br>hi guys,<br><br>Just a note to let you know th at I have emailed Alvin requesting his time for assistance in 2nds World Print plus install.<br><br>I need a current mobile number for Alvin if either of you do not have it please advise where I can get this from.<br><br>regards,<br><br></div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Fri 15 May 2009 6:16PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    FYI � The Print+ templates for the online stores are ready for dispatch. <br><br>Frankie : <br><br>� The entire config is located on Artemis under /u/printplus_dev/tbeprint.second/ <br><br>� TBE report maps will need to be setup, refer to /u/printplus_dev/tbeprint.second/etc/tbeprint.conf file<br><br>o eg. Online � Invoice = rptWebInvoice<br><br>� We will also need clarification from Alvin on the following items:<br><br>o Installing Perl modules on Linux <br><br>o Configuring and deploying Fax and Email functionality for Print+ (on the Linux OS Level)<br><br><br>Kind Regards,<br>Mitul Patel<br>Numara Software Australia<br>Suite 1, 651 Canterbury Road<br>Surrey Hills, VIC 3127<br></div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Fri 15 May 2009 7:01PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:mitul.patel@numarasoftware.com.au;Frankie@unisoft.com.au cc:techsupp@unisoft.com.au;annieh@unisoft.com.au bcc:<br>-------------------------------------------<br>Hi Gents,<br><br>Unfortunately I am out of Melbourne on Sunday, and I am trying to ensure I have a complete list of questions to ask Alvin when he comes in.<br><br>Mitul has suggested:<br><br>- Installing Perl modules on Linux<br>- Configuring and deploying Fax and Email functionality for Print+ (on the Linux OS Level)<br><br>Further I would like to know:<br>- Why was the perl scripts not ported to SUSE?<br>- Why was SUSE chosen?<br><br>Tony would Like to Know:<br>- Can we re-direct fax services from the Auburn printer to another state while we fix this issue?<br><br>I am sure there are a million other questions!<br><br>Please feel free to crank out as many as you can think of.<br><br>Best regards<br>Bruce</div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Fri 15 May 2009 7:03PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:mitul.patel@numarasoftware.com.au cc:techsupp@unisoft.com.au bcc:<br>-------------------------------------------<br>Hi Mitul,<br><br>Thanks for letting us know about those images for seconds world, will save us a lot of time!<br><br>Are all system configs stored in that location?<br><br>How do I organise myself a log on to the network to view things? or is that my job? 8)<br><br>Best Regards<br>Bruce</div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Wed 20 May 2009 10:19AM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    Print server images are kept.<br><br>Server images //artemis/u/printplus_dev<br><br></div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Tue 26 May 2009 5:59PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    Server Tested today with Suiming, need to add IP addresses of new site nad templates to suite in order to ship</div>

     <div>
     <hr>
              <span Style="Color:red">Tony Zdraveski</span>
                 <span Style="Color:DarkGreen">Tue 2 Jun 2009 12:20PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    Received Email from Jai at 2nds World, he advises that he weill get back to me with IP adresses and gateway for Penrith store as soon as it is available from his IT consultants. PC will be sitting here waiting for these details and will then be updated and sent out.</div>

</cell>

<cell>
<img height="10" width="10" title="This job is Over Due. Click to add a new note" src="images/Urgent.gif">
</cell>
<cell>01</cell>
<cell>Set up Print server for Penrith.</cell>
<cell>16 May 2009</cell>
<cell>2nds World</cell>
<cell>Client will call to organise installation</cell>
<cell>Bruce Lock</cell>
<cell></cell>
<cell/>
<cell>Assigned</cell>
<cell>Pending</cell>
<cell>0</cell>
</row>

<row id="56">
<userdata name="gURL">frmJob.asp?CompanyID=42&JobID=56</userdata>
<userdata name="gTable">tblJobs</userdata>

<cell>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Thu 25 Jun 2009 6:29PM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:johns@unisoft.com.au cc:annieh@unisoft.com.au;Judi@unisoft.com.au;annieh@unisoft.com.au bcc:<br>-------------------------------------------<br>Hi All.<br><br>The dial out modem on Apollo stopped working today and needs replacement.<br><br>We have swapped it with the modem that we set up for the test server.<br><br>However we need to swap that back in to do testing for fax, and send it out with the server.<br><br>What's the process to order a replacement modem?<br><br>Regards</div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Fri 26 Jun 2009 9:45AM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    To:techsupp@unisoft.com.au cc: bcc:<br>-------------------------------------------<br>Hi Tony.<br><br>As per Johns instructions below, can you organise for an order to be placed for a new modem?<br><br>Is that something you know how to do or have done before?<br><br>If not, let me know and I will question John on it.<br><br>Regards<br><br>--------------------------------------<br><br>Either buy one with CC if you cannot wait, otherwise ask Tony to place purchase order with a supplier.<br><br>John <br><br>John Sestan - Director<br>Unisoft Pty Ltd<br>Address: Suite 1, 651 Canterbury Road, Surrey Hills, VIC 3127<br>Phone: +61-3-9890-5122 Facsimile: +61-3-9890-5166 Mobile 0408 109052<br>e-mail: johns@unisoft.com.au</div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Yesterday 10:11AM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    Hi All.<br><br>There is something seriously wrong with the set up with Apollo and or the phone lines.<br><br>The phone lines seem to have gone very quiet and the modems are not detecting dial tone.<br><br>Well the US robotics ones are.<br><br>The server is also throwing up random SCSI block errors (not a good sign).<br><br>And is coming back with interrupt device errors, also not a good sign.<br><br>Further frustrating diagnosis is the fact that if I knock the main server, it sometimes reboots, this is quickly followed by cries of dismay from Frankie and Judi.<br><br>Therefore I have to be very careful in trying to work on Apollo.<br><br>So I have set up a dial up modem connected to powerterm on the support PC and showed Judi how to use it.<br><br>Tony and I will need to look into what�s set up, there are at least four different modems onto different phone lines with different combinations of set ups for the connect script.<br><br>Therefore the system will need to stay on the support PC until we get a chance to do some more diagnosis.<br><br>Hopefully without effecting the main server.<br><br>We will look into it tomorrow.<br><br>Regards<br>Bruce<br></div>

     <div>
     <hr>
              <span Style="Color:red">Bruce Lock</span>
                 <span Style="Color:DarkGreen">Yesterday 11:34AM</span>
                 <hr>
     </div>
     <div style="padding-left: 10px">
                    Managed to get fax out working.<br><br>Server still coming up with errors in interrupts.<br><br>Seems to be working though.</div>

</cell>

<cell>
<img height="10" width="10" title="This job is Over Due. Click to add a new note" src="images/Urgent.gif">
</cell>
<cell>056</cell>
<cell>Outbound modem not working</cell>
<cell>27 Jun 2009</cell>
<cell>Unisoft</cell>
<cell></cell>
<cell>Mitul Patel</cell>
<cell></cell>
<cell/>
<cell>New Issue</cell>
<cell>Open</cell>
<cell>0</cell>
</row>
Answer posted by Support on Jul 01, 2009 02:50
SubRow data is stored in the same way as row related user-data ( actually it can be retrieved as grid.getUserData(rowId, "sub_row"); ) and as other row's related user-data - it will be sent to server during data sending. 
Technically it must not break POST data sending, but if it causes problems in your case - please try to use attached dhtmlxdataprocessor.js instead of original one. It is updated to ignore sub_row data , and to not include it in data request.
Attachments (1)
Answer posted by Block on Jul 01, 2009 02:58
Actually you were right.

The problem was my broken server data connector, but thank for the quick reply.

Can I turn that option off using a switch?

Whilst I appreciate the rapid response, I wish to stick with the standard libraries for the purposes of longer term maintenance.

Regards
Answer posted by Support on Jul 01, 2009 04:21
Your XML snippet contains some other userdata info, is it necessary for server side operations? or removing all user-data from server side request will work for you?
Answer posted by block on Jul 01, 2009 16:52

Actually now is a pertinent time to ask for your advice before I pursue too far down the wrong chanels.

The general techniques I am using is to put the URL's into the UserData in the trees and grids, as I re-use the components for different functions.

Is that the best way to go?

For example in the case of the grid, I have two pieces of user data, gURL and gTable.

I use gURL to pass through to the onrowclick event that in turn passes it to the attachURL event for the bottom panel of my layout control.

I use the same grid in section b of my layout control to display a number of different layouts, jobs, opportunities, emails, projects, reports, etc

These are loaded using the onclick even on a tree control, which I use the same technique, I load the source XML URL into the userdata for the tree control, then pass that to the on click event for re-loading the main grid.

I use the gTable userdata to pass through to my dataprocessor handler, as I use the same control for multiple uses (tables), so I need to identify what I am using it for.

You will note that I am storing the table field name in the heading information in the XML string with f:<table field name> to indicate a direct updateable field.

(f:username for example is the field "username" in the current save table indicated by the gTable variable.)

I could just as easily use a two part heading id that had the table and the field name in it (f:<gTable>:<table field>) and use the loverly split funtion to load the data up into an array.

Or even use a reference back to the tree grid to see whats selected and then use that to determine the c cell layout URL on the grid rowclick event.

Or even (if I cant use sub_row in conjunction with grouping on the grid) resort to loading up a right click menu on the grid and having people chose open something before displaying the bottom panel.

However that means changing the right click menu for every re-load of the grid.

Which I assume I can do in the on row click even function section (see functions below).

So....

What do you guys use when deploying the component for your own projects?

Regards

------ Code Snipets

function doOnTreeClick(id) {

//var jDebugMode = 1;

//if (jDebugMode == 1) alert(dhxTree.getUserData(id, "gURL") + "&SID=<%=session.sessionID%>&D=<%=Now%>");

if (dhxTree.getUserData(id, "gURL") != 'None') {

LoadGrid(dhxTree.getUserData(id, "gURL"), dhxTree.getUserData(id, "gOpt"));

LoadStatusWindow(dhxTree.getUserData(id, "gOpt"));

};

};

function doOnRowSelected(id) {

dhxLayout.cells("c").attachURL(dhxGrid.getUserData(id, 'gURL'));

};

function LoadGrid(iURL,iCookie) {

var iDate = new Date();

var iTime = iDate.getTime();

//if (jDebugMode == 1) alert(iURL + "&SID=<%=session.sessionID%>&D=" + iTime);

if (cur_Grid != iURL) {

cur_Grid = iURL;

if (jDebugMode == 1) {

dhxStatus.setText(iURL + "&SID=<%=session.sessionID%>&D=" + iTime);

alert(iURL + "&SID=<%=session.sessionID%>&D=" + iTime);

} else {

dhxStatus.setText("Loading Data From Server.......");

};

dhxGrid.enableAutoSizeSaving(iCookie); //enable automatic saving width

dhxGrid.loadXML(iURL + "&SID=<%=session.sessionID%>&D=" + iTime, function() {

dhxGrid.loadSizeFromCookie(iCookie);

if (jDebugMode != 1) {dhxStatus.setText("Loading Complete")};

});

};

};

Answer posted by block on Jul 01, 2009 17:03

Um sorry, I didnt answer the question.

Yes I can remove all userdata if required.

Regards

Answer posted by Support on Jul 02, 2009 05:58
>>I use gURL to pass through to the onrowclick event
It is common approach, and actually is main purpose of user-data functionality .

>>I use the gTable userdata to pass through to my dataprocessor handler
This kind is a bit more tricky - by using js debug plugins, user will be able to alter user-data and, as result, change the logic of server side actions. 
If you sure that such possibility doesn't introduce security problems in your case - there is no any other problems with such approach. 

>>What do you guys use when deploying the component for your own projects?
Using userdata for exta information related to the row - is a normal approach, just beware that user will be able change such data, so its not a good place for private data. 
Starting from grid 1.6 - it is possible to store extra info in row attributes, but it has not any significant advantages except of smaller xml size.


Answer posted by Support on Jul 02, 2009 06:05

Updated dthmlxdataprocessor.js and dhtmlxgrid_excell_sub_row.js are sent by email. 
Similar changes will be introduced in next version of the grid. 

Answer posted by block on Jul 02, 2009 16:10
>>>I use the gTable userdata to pass through to my dataprocessor handler
>This kind is a bit more tricky - by using js debug plugins, user will be able to alter user-data and, as result, change the logic of server side actions. 
>If you sure that such possibility doesn't introduce security problems in your case - there is no any other problems with such approach.

Ahh yes, good point, field is fine, table is not.

I should also make sure I strip off any sub query related text to ensure I avoid SQL injection type of attacks.

Regards