Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Anuj on Sep 24, 2008 00:26
open dhtmlx forum
DHTML Grid having comb with different values for differnt cell in same colum on the base database.

I want to add diiferent values to combo box in colum 2

but every cell of colum 2 having different cell .

How can i add different values to combo

i use tow different methods but both of then are not working.

first one i retrive data from xpath and if i use

mygrid.attachEvent("onEditCell",function(stage,id,ind,value)
{
if (stage==0)
{
if(ind==5)
{
var strvalue=mygrid.cells(id,3).getValue();
if(strvalue=="Delhi")
{
placecode='DEL';
// GetVehile();
}
else if(strvalue=="Agra")
{
placecode='AGR';
//GetVehile();
}
else if(strvalue=="Mumbai")
{
placecode='BOM';
//GetVehile();
}
else if(strvalue=="Jaipur")
{
placecode='JAI';
//GetVehile();
}
else if(strvalue=="Jammu")
{
placecode='IXJ';
//GetVehile();
}
else if(strvalue=="Manali")
{
placecode='MNL';
}
xml=loadXMLDoc("../XML/Transfers.xml");
path="/TransferDetails/Transfer[@PCode='"+placecode+"']/@Vehicle";
var combo = mygrid.getCustomCombo(5);
combo.clear();
// code for IE
if (window.ActiveXObject)
{
var nodes=xml.selectNodes(path);

for (i=0;i<nodes.length;i++)
{
combo.put(nodes[i].childNodes[0].nodeValue,nodes[i].childNodes[0].nodeValue);
alert(nodes[i].childNodes[0].nodeValue);
}
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{

var results = evaluateXPath(xml, path);
for (var i in results)
combo.put(results[i].value,results[i].value);
}
}
}
return true;
});

and second type

res += "<head> " +
" <column width='50' type='ro' align='center' color='#d5f1ff' >Sr No.</column> " +
" <column width='50' type='ro' align='left' >Itinerary Code</column> " +
" <column width='150' type='ro' align='center' >From Date</column> " +
" <column width='100' type='ro' align='left' >From Place</column> " +
" <column width='80' type='ed' align='left' >Mode</column> " +
" <column width='120' type='coro' align='left' >Vehicle </column> " +
" <column width='80' type='ro' align='right' >Transfer</column> " +
" <column width='100' type='ro' align='center' >Rate</column> " +
" <column width='100' type='ro' align='right' >Staying Nights</column> " +
" <settings> " +
" <colwidth>px</colwidth> " +
" </settings> " +
" </head> ";
res += this.GetXmlGrid();

else if (param.Attributes["name"].Value == "vcVehicle")
{

res += "<cell xmlcontent='true'>";
string strPlaceCode = GetPlaceCode(r["vcFromPlace"].ToString());
if (strPlaceCode != string.Empty)
{
DataSet dsVehicle = GetVehicle(strPlaceCode);
if (dsVehicle.Tables.Count > 0)
{
int i = 0;
foreach (DataRow dr in dsVehicle.Tables[0].Rows)
{
res += "<option value='" + i + "'>" + dr["Vehicle"].ToString() + "</option>";
i++;
}

}
}
res += "</cell>";
}

in second format xml generate but not loades in grid and javascript error comes object requierd or i remove type='coro' from head then error comes excelcell_null comes

grid.getCustomCombo(index)

gives error of property not supported.

i already check given links but they does't support to my cause.

http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Selectbox_collections.html#grid_art_selectbox

and

http://dhtmlx.com/docs/products/dhtmlxGrid/samples/cell_types/pro_dynamic_combo.html?un=1220892732000



Please Help me

Thanks in advance

Anuj Sharma


Answer posted by dhtmlx support on Sep 24, 2008 06:52
>> grid.getCustomCombo(index)  gives error of property not supported.

The getCustomCombo has two parameters row id and column index:

grid.getCustomCombo(row_id,col_index);

>> in second format xml generate but not loades in grid and javascript error comes object requierd

Please, provide the example of generated xml where issue can be recreated