Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by santosh on Nov 08, 2008 06:54
open dhtmlx forum
data is not displaying in grid in portlets

Hi,

xml data is not getting displayed in portlets...

My code is ...


<body>
    
<div id="xmlIsLand" style="display:none" width="200" height="200" ><%=request.getAttribute("xmlString")%></div>

<div id="gridbox" width="200" height="200" ></div>
<script src="/wps/js/dhtmlxcommon.js"></script>
<script src="/wps/js/dhtmlxgrid.js"></script>
<script src="/wps/js/dhtmlxgridcell.js"></script>
<link rel="STYLESHEET" type="text/css" href="/wps/css/dhtmlxgrid.css">
<link rel="STYLESHEET" type="text/css" href="/wps/css/dhtmlxgrid_skins.css">
    <script language="javascript">
    mygrid = new dhtmlXGridObject('gridbox');
        mygrid.selMultiRows = true;
        mygrid.setImagePath("/wps/imagegrid/icons_greenfoldersimages/");    
        mygrid.setHeader("First Name,Last Name,Country,Email,Role");
        mygrid.setInitWidths("100,100,100,100,200");
        mygrid.setColAlign("left,center,center,center,center");
        mygrid.setColSorting("str,str,str,str,str");
        mygrid.setColTypes("ro,ed,ed,ro,ro");
        mygrid.enableCollSpan(true);
        mygrid.enableTooltips("false,false,false,false,false");
        mygrid.enableMultiline(true);
        mygrid.enableEditEvents(true,true,true,true,true);
        mygrid.init();
        mygrid.setSkin("modern");
        mygrid.clearAll();
     mygrid.parse(document.getElementById("xmlIsLand").innerHTML);



This is working perfectly fine when i tested in eclipse.
But the data is not loading in IBM portlets in LDE .

Header names are coming correctly.

Even i tested for "<%=request.getAttribute("xmlString")%>"..the data is coming when i click on view page source in browser..

but it is not displaying in grid..

Pls help me .


Thanks,
Santosh.
Answer posted by Support on Nov 11, 2008 03:54
>>document.getElementById("xmlIsLand").innerHTML
This code is not cross browser safe, based on used doctype it may result in different data returned
The next is more safe approach
- if string a quote safe
           mygrid.parse("<%=request.getAttribute("xmlString")%>");
- in other case
     <textarea id="xmlIsLand" style="display:none"><%=request.getAttribute("xmlString")%></textarea>
      ...
      mygrid.parse(document.getElementById("xmlIsLand").value);
Answer posted by santosh on Nov 11, 2008 04:19
i used mygrid.parse...
it is saying it is not a function.

I am having 1.6 pro version.

and even i used below code
 <textarea id="xmlIsLand" style="display:none"><%=request.getAttribute("xmlString")%></textarea>
      ...
      mygrid.parseXML(document.getElementById("xmlIsLand").value);


it is saying document.getElementById("xmlIsLand").value is not a function.

pls advice

Answer posted by Support on Nov 11, 2008 05:39
Which version of dhtmlxgrid you are using?
In case of dhtmlxgrid 1.5 or lesser the command above must be as 
- if string a quote safe
  mygrid.loadXMLString("<%=request.getAttribute("xmlString")%>");
- in other case
  <textarea id="xmlIsLand" style="display:none"><%=request.getAttribute("xmlString")%></textarea>
  ...
  mygrid.loadXMLString(document.getElementById("xmlIsLand").value);