dHtmlGrid

I have a xmlstring as well as xmldocument object in my servlet.

(1) How to load the serverside xmlstring/xmldocument object to the grid. I dont want to save any xml in client’s machine. Can you give me an example?

(2) Also i want to save the xml in db through ajax from grid.

(3) How to set the properties of individual cell.(font color, size, font family etc) style attribute is available for row. But i want to set it for individual cell.


Here is a simplest way to generate XML inline by generating javascript loadXMLString(" …") directly from jsp 



( notice you should have " in javascript value , so should have \" in java generating javascript )



 mygrid.loadXMLString("<%
 out.print("");
 out.print("");
 out.print("<column width=\“50\” type=\“ed\” align=\“center\”  sort=\“str\” id=\“SOLD\”>sold");
 out.print("<column width=\“140\” type=\“ed\” align=\“center\”  sort=\“str\” id=\“TITLE\”>Title");
 out.print("<column width=\“100\” type=\“ed\” align=\“center\”  sort=\“str\” id=\“AUTHOR\”>Author");
 out.print("<column width=\“80\” type=\“ed\” align=\“right\”  sort=\“int\” id=\“PRICE\”>Price");
 out.print("<column width=\“80\” type=\“ch\” align=\“center\”  sort=\“int\” id=\“STOCK\”>available");
 out.print("<column width=\“80\” type=\“ra\” align=\“center\”  sort=\“date\” id=\“BEST\”>Best seller");
 out.print("<column width=\“150\” type=\“ro\” align=\“center\”  sort=\“str\” id=\“DATEPUB\”>Date “);
 
 out.print(”");
 // loop for lines of values
  String snb=request.getParameter(“nb”);
  if(snb == null ) snb= “100”;
  int nb=new Integer(snb).intValue();
  for (int i=0;i<nb;i+=1){
    out.print("");
    out.print(""+i%50+"");
    out.print(“text for book “+new Integer(i)+””);
    out.print(“author”+new Integer(i)+"");
    out.print(""+i*100+"."+i+"");
      out.print(""+i%2+"");
      out.print(""+(i+1)%3+""); 
      out.print(""+((i%30)+1)+"/"+((i%12)+1)+"/"+(2000+i%10)+""); 
      out.print("");  
  }
    out.print(""); 
    // end generation of loadXMLString(datas,functionAfterLoad)
    out.print("");");
 %>  



 



A better way is to use the loadXML syntax for the grid



mygrid.loadXML(“myNewJSP.jsp”);



and to furnish an independant jsp that generate only the previous string ( no need to escape twice) with surrounding



("<?xml version=\"1.0\" encoding=\"UTF-8\"?>







");



( See java examples within download)



 



while myNewJSP.jsp just do