Categories | Question details Back To List | ||
printview does not work properly on the grid 1. printview work fine if i load the grid and then call printview, but if after load I'll run addrow(..) to it, the row will be added to the grid but on the printview the last added row will print twice? how to fix it 2. if i use acheck as column type on output it will be 0 or 1 should I parse html manually or there is a fix for it? Answer posted by Stanislav (support) on Jan 21, 2010 01:36 >>the last added row will print twice? how to fix it - be sure that you are using correct ID value for new row - if issue still occurs - please provide a code snippet, which you are using for row adding Answer posted on Jan 21, 2010 08:21 <!-- Main File --> <input type="hidden" id="TimeStmp" value="<?php echo date("Y-m-d h:i:s");?>"> <div id="OutParts" style="width:365;height:135"></div> <input type="button" onclick="addOutPart(1,1,1,1,100)"> <input type="button" onclick="btnSaveClicked()"> <script> OutPartsGrid = new dhtmlXGridObject('OutParts'); OutPartsGrid.setSkin("light"); OutPartsGrid.seteditable=true; OutPartsGrid.enableEditEvents(false,false,false); OutPartsGrid.imgURL = "dhtmlxGrid/codebase/imgs/"; OutPartsGrid.loadXML("OutParts.php?Tech=1", function(){}); OutPartsGridProcessor = new dataProcessor("OutPartsUpdt.php?Tech=1&ts="+document.getElementById("TimeStmp").value); OutPartsGridProcessor.enableDataNames(true); OutPartsGridProcessor.setUpdateMode("off"); OutPartsGridProcessor.defineAction("error",myErrorHandler); OutPartsGridProcessor.setTransactionMode("POST"); OutPartsGridProcessor.init(OutPartsGrid); OutPartsGridProcessor.defineAction("debug", dpDebug); function addOutPart(id,type,qty,qtytotal,price){ if (OutPartsGrid.getRowIndex(id)==-1){ OutPartsGrid.addRow(id,type+"^javascript:delPartOut("+id+");^_self,"+qty+","+qtytotal+","+price,OutPartsGrid.getRowsNum()+1) }else{ alert ("ATTENTION!!! THIS PART IS ALREADY IN THE LIST"); } document.getElementById("PartOut").value=0; document.getElementById("QTYPartOut").value="1"; } function btnSaveClicked(){ OutPartsGridProcessor.sendData(); setTimeout("gridsUpdate();",1250); } function gridsUpdate(){ OutPartsGrid.parentGrid = true; html = OutPartsGrid.printView(); OutPartsGrid.parentGrid = null; win=window.open('','mywindow','width=800,height=500,scrollbars=yes'); win.document.writeln(html); } </script> <!-- OutParts.php File --> <?php usleep(500000); header("Content-type:text/xml"); print('<?xml version="1.0" encoding="UTF-8"?>'); print ("<rows>"); print('<head>'); $head=explode(",","Part Type,QTY,Total,Price"); $size=explode(",","100,50,50,60"); $colType=explode(",","link,ed,ed,price"); $sorting=explode(",","na,na,na,na,na"); $i=0; while ($i<4){ print('<column id="'.$head[$i].'" width="'.$size[$i].'" type="'.$colType[$i].'" align="left" sort="'.$sorting[$i].'">'.$head[$i].' '); print('</column>'); $i++; } print('</head>'); //********************** print("</rows>"); ?> Answer posted by Eugene on Jan 21, 2010 08:29 Row is being added to the grid without any errors or isues, I can work with it, if I enable the processor it works fine, but on the print is where it doubles, code is only for adding one row but it still produces double on the print, in my code I use phpfiles to pull data from the db so it's a bit more complicated, though when I add more and more rows last rows are being duplicated on the print but on the display it is fine: output is like this row1 row2 row3 row4 row5 row3 row4 row5 or row1 row1 or row1 row2 row2 Answer posted by Alex (support) on Jan 21, 2010 08:34 >> addOutPart(1,1,1,1,100) It seems that you use the same id for all rows. Ids must be unique. Answer posted on Jan 21, 2010 09:33 i use unique ids, i just simplified the code, u can put addOutPart(OutPartsGrid.getRowsNum()+1,1,1,1,100) if I would not use unique id it would not let me add it to the grid. the problem is when I get printview html code i got row doubled Answer posted by Eugene on Jan 21, 2010 16:57 i use unique ids, i just simplified the code, even if I put addOutPart(OutPartsGrid.getRowsNum()+1,1,1,1,100) if I would not use unique id it would not let me add it to the grid. the problem is when I get printview html code i got row doubled, even if there is only one row Answer posted by Alex (support) on Jan 22, 2010 01:34 Please provide the complete demo that allows to recreate the issue ( http://www.dhtmlx.com/docs/support/what_is_a_completed_demo.htm ) You can send this sample to support@dhtmlx.com |