Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by pyt on Sep 03, 2008 04:12
open dhtmlx forum
Running grid methods from XML

Hi,

how can i specify attachEvent within xml?

Thanks in advance!
Answer posted by Support on Sep 03, 2008 05:52
you can't specify exact js code in XML, but if you have some function in HTML file

function onActionDo(){ some_code() }

You can have in XML file a next statement
<rows>
<head>
  ...
  <afterInit><call command="attachEvent"><param>onRowSelect</param><param>onActionDo</param></call></afterInit>
  

Answer posted on Sep 03, 2008 07:24
Hi,
it doesn't work with your example. The following is the code for initialising the grid:
<script>
  var mygrid;
  function doInitGrid(){
   mygrid = new dhtmlXGridObject('mygrid_container');
   mygrid.setImagePath("/otdassist/images/imgs/");
   mygrid.enableBlockSelection();
   mygrid.copyBlockToClipboard();
   mygrid.init();
   mygrid.loadXML("xml_feed.jsp?action=get_data");  
  }

and the following is a part of xml code (in java):
...
out.append("<beforeInit>");
...
out.append("</beforeInit>");
out.append("<column width=\"150\" type=\"ro\"  align=\"right\">Title </column>");
...
out.append("<afterInit>");
out.append("<call command=\"attachEvent\"><param> onEditCell </param><param> doOnEditCell </param></call>");
out.append("</afterInit>");
out.append("</head>");

it doesn't work with mygrid.init() nor without. Have you any idea?

Thanks in advance!

Answer posted by Support on Sep 03, 2008 08:20

>>out.append("<call command=\"attachEvent\"><param> onEditCell </param><param> doOnEditCell </param></call>");
There are unnecessary whitespaces inside param tags which cause problems.

Please check attached sample. 

Attachments (1)