Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by David Chacon Andrade on Jun 24, 2009 07:30
open dhtmlx forum
How to set column names on XML

MY XML.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rows>
<head>
<column align="right" sort="int" type="ro" width="80">CostumerId</column>
<column align="right" sort="int" type="ro" width="80" TableProduct="products">ProductID</column>
<column align="right" id="38" sort="str" type="ed" width="80">NameOfCosutumer</column>
<column align="right" id="38" sort="str" type="ed" width="80">Addres</column>
</head>
<row id="1" >
<cell>1</cell>
<cell>45</cell>
<cell>Martin</cell>
<cell>cll 4 # 36 54</cell>
<row>
<row id="2" >
<cell>2</cell>
<cell>48</cell>
<cell>Sandra</cell>
<cell>cll 4 # 36 as</cell>
<row>
</rows>

HOW TO SET COLUMN NAMES ON THE XML FILE FOR THAT DATAPROCESOR ON SENDDATA() EVENT TAKE THE RESPECTIVE COUMN NAMES.

Answer posted by dhxSupport on Jun 24, 2009 07:44
You should use following data processor command:
 dp.enableDataNames(true);
Answer posted on Jun 24, 2009 08:22
Ok, I set the dataprocesor with enableDataNames(true) but on server side or queryString the column names are undefined for example

request.getQueryString() = gr_id=23636&undefined=23636&undefined=45


SO, in my xml where put the name values??????? pls example
Answer posted by dhxSupport on Jun 24, 2009 08:42
Unfortunately we cannot reproduce this issue locally. Please contact support@dhtmlx.com and provide sample where we can reproduce this issue. 
Answer posted by David Chacon on Jun 24, 2009 08:55
ok, instead the answer.

Configuration via xml. What is attribute that set the name of column. FOR EXAMPLE

IN THIS XML WHERE AND WHAT ATTRIBUTE I MUST PUT.
<head>
  <column align="right" sort="int" type="ro" width="80">CostumerId</column> 
  <column align="right" sort="int" type="ro" width="80" >ProductID</column>
</head>

OR YOU CAN  ATTACH A XML CONFIGURATION EXAMPLE WITH NAME COLUMNS?

THANKS
Answer posted by dhxSupport on Jun 24, 2009 09:15
<column> xm tag has attribute "id" which will be used as column id. 
<column align="right" sort="int" type="ro" width="80" id="ProductID">Product Label</column>

You can find dhtmlxGrid xml format explanation here http://dhtmlx.com/docs/products/docsExplorer/doc/dhtmlxxml/index.html#dhtmlx_xml
Answer posted on Jun 24, 2009 09:27
PERFECT !!!!
Answer posted by David Chacon on Jun 24, 2009 09:37
SORRY I HAVE A NEW QUESTION ABOUT THIS TOPIC.

I CAN GET THE VALUE OF CELL WITH THE COLUMN NAME??

FOR EXAMPLE
<column align="right" sort="int" type="ro" width="80" id="ProductID">Product Label</column>

mygrid.cells(mygrid.getSelectedRowId(),"ProductID").getValue();

HOW TO??

Answer posted by dhxSupport on Jun 25, 2009 02:55

You can get cell's value if you know row ID or row Index and column Index:

var value=mygrid.cellById(rowID,cellINDEX).getValue();
or
var value=mygrid.cellByIndex(rowINDEX,cellINDEX).getValue();

If you know id of column you can get it's index using:
var columnINDEX=mygrid.getColIndexById(columnID);

Also you can get column id if you know it's index:
var columnID=mygrid.getColumnId(columnINDEX);


You can find list of all available API methods here http://dhtmlx.com/docs/products/dhtmlxGrid/doc/alpha.html#grid_api_a