Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by James Mackinnon on Dec 13, 2007 12:07
open dhtmlx forum
Using DHTMLXGridTree (3 issues)

Hi all

Ok, let me explain my challanges

I just purchased the enterprise version of the DHTMLX components

Issue 1
What I am doing is pulling my data from a DB and storing it in XML on the server in encrypted form but when it loads into the grid, I want it to run through mcrypt to decrypt the data. I can't see how to process each row through my mcrypt function to handle this.

Is there a way that I can process the data from the db and right into the grid without creating the xml on the server this way my code could stream into the grid and decrypt. My reason for this is I can't have anyone able to access / view the encrypted data but only the user who is logged in and owns the specific data.

Issue 2
How can I disable the double click / edit of a cell in the grid as by default, when i double click a cell in the grid, it gives me the ability to edit the cell

Issue 3
When I drag and drop an item into the tree, I don't want it to expand the folders or display the items in the folders in the tree. What I want to do is use the folders as containers and drop files into them. Then, when I click on the folder I will have it linked to read from the server the folder and all of its contents and display it in my grid on the right hand side

Think webmail

Thanks

James
Answer posted by Support on Dec 14, 2007 02:48
>>Is there a way that I can process the data from the db and right into the grid without creating the xml on the server this way my code could stream into the grid and decrypt.
Actually storing data in intermediate file is not necessary , you can load data directly through server side script\

grid.loadXML("some.php");

---------- code of some.php -----------
<?php
    header("Content-type:text/xml");   //mark output as XML
    print ("<?xml version='1.0' ?>");

    ... connect to DB ...
    ... fetch data ....
    ... for each row ...
       print("<row...

?>

The similar solution can be implemented for any other server side platform. Default package contains samples for PHP only, if you need it to some other server platform - contact us at support@dhtmlx.com

Answer posted by James Mackinnon on Dec 14, 2007 06:38

I have #1 fixed, I figured out the usage of the php and header yesterday right after posting.

However, I also disabled the editing of a cell by using
                        mygrid._doClick=function(){};
But this also removed my ability to select an item (highlight) and select multiple items for moving

I tried
                        mygrid._dodblClick=function(){};
but it doesn't work. I can now highlight and select multiple but I can also double click agian

Lastly, the tree is an issue. I need it to only act as a container and not show the items in each container. What option do I have to doing this.

Basically, I want to generate a list of folders from php and xml and when I click on one, I will have it update the grid based on the data that is stored in that.

Thanks

James

Answer posted by Support on Dec 14, 2007 07:27
>>How can I disable the double click / edit of a cell in the grid as by default, when i double click a cell in the grid, it gives me the ability to edit the cell
the events by which grid switched to "edit" state can be configured by
    grid.enableEditEvents(....
the next command will disable edit for all user operations, include doubleclick
    grid.enableEditEvents(false,false,false);

>>When I drag and drop an item into the tree, I don't want it to expand the folders or display the items in the folders in the tree.
In such case, you need not real d-n-d process. You can just use event, to get notification that some item was moved, and block any real moving.

tree.attachEvent("onDrag",function(sid,tid){
    ... any custom code here ...
    return false; //block real d-n-d
});
Answer posted by James Mackinnon on Dec 14, 2007 07:29

I tried

 

tree.attachEvent("onDrag",function(sid,tid){
    return false; //block real d-n-d
});

However, it never removes the item out of the Grid

 

Such as, I have one entry that has

 

1 | James Mackinnon | 12/12/2007

 

This is in the default grid / inbox

 

When I try to move it to a folder called James Mackinnon it doesn't take it out of the inbox grid

I havn't got to the point of updating the DB yet, this would follow

 

Thanks

 

James

 

Answer posted by Support on Dec 14, 2007 08:23
This is correct , because you fully block d-n-d operation, you can use

tree.attachEvent("onDrag",function(sid,tid){
    grid.deleteRow(sid);   //remove row from grid

/*
    In this point you have all necessary info to made update in DB
    sid - id of element
    tid - id of target folder
    so you may call server side script with such params and made update in DB
       update Files set fkFolderId={tid} where pkFileId={tid};
*/

    return false; //block real d-n-d
});