Hi Sematik,
Thanks for your reply.
All my data is loaded from the sql server. I have set the column type to link, dhtmlxgrid_excell_link.js is included. File paths are stored as “somename.pdf”. All links point to a file stored on my server. I haven’t hard pathed them because I haven’t purchased a domain yet.
I’ve never worked with JSON before, is there no way to do this from the connector? Or do i have to generate the XML file from the connector?
Below is a copy past of my code so you can have a look:
<script src="../../dhtmlx/codebase/dhtmlx.js" type="text/javascript"></script>
<!-- dhtmlx.css contains styles definitions for all included components -->
<link rel="STYLESHEET" type="text/css" href="../../dhtmlx/codebase/dhtmlx.css">
<script src="../../dhtmlx/codebase/connector/connector.js" type="text/javascript"></script>
<script src="../../dhtmlx/codebase/ext/dhtmlxgrid_export.js" type="text/javascript"></script>
<script src="../../dhtmlx/codebase/excells/dhtmlxgrid_excell_link.js" type="text/javascript"></script>
<script src="../../dhtmlx/codebase/dhtmlxgridcell.js" type="text/javascript"></script>
<script type="text/javascript">
var layout,toolbar,custGrid;
dhtmlx.image_path = "../../dhtmlx/codebase/imgs/";
dhtmlxEvent(window,"load",function(){
//layout
layout = new dhtmlXLayoutObject("layout","1C");
layout.cells("a").setText("Customer");
layout.cells("a").setWidth(400);
toolbar = layout.attachToolbar();
toolbar.setIconsPath("../../icon/");
toolbar.loadXML("../../dhtmlx/codebase/xml/customer_files_master.xml");
custGrid = layout.cells("a").attachGrid();
//contactGrid.setImagePath("./codebase/imgs/");
//contactGrid.setSkin("dhx_skyblue");
custGrid.setHeader("File ID, Billing ID, Shipping ID, Company Name, File Name, File Type, File Description, file");
custGrid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
custGrid.setInitWidths("130,130,130,130,130,130,130,130");
custGrid.setColAlign("left,left,left,left,left,left,left,left");
custGrid.setColTypes("ro,ro,ro,ro,ro,ro,ro,link");
custGrid.setColSorting("str,str,str,str,str,str,str,str");
custGrid.enableSmartRendering(true);
custGrid.init();
custGrid.load("customer_files_master_connector.php");
//toolbar
toolbar.addText("exportPDF", 1,'<a href="../../dhtmlx/codebase/grid-pdf-php/generate.php">Print to PDF</a>');
toolbar.addText("newCust", 2,'<a href="customer_files_add.php"><img src="../../icon/savesmall16.png" width="18" height="18"/></a>');
toolbar.attachEvent("onclick",function(id){
if(id=="delCust"){
var rowId = custGrid.getSelectedRowId();
if(rowId!=null){
var selectedIndex = custGrid.getRowIndex(rowId)
custGrid.deleteRow(rowId);
if(selectedIndex!=(custGrid.getRowsNum()-1)){
custGrid.selectRow(selectedIndex+1,true);
}
else{
custGrid.selectRow(selectedIndex-1,true)
}
}
}
});
var dpg = new dataProcessor("customer_files_master_connector.php");
dpg.init(custGrid);
})
</script>