Hi Alex,
I am using dataprocesser for storing grid values into the database. My grid has two combos and along with other values of grid, I need to pass the value(which is hidden) of combo through the dataprocesser for saving.
Following code I am using for saving grid data.
function save(){
var valid = true;
for (var i=0; i<myDataProcessor.updatedRows.length; i++)
valid&=myDataProcessor.checkBeforeUpdate(myDataProcessor.updatedRows[i]);
//if(valid)
myDataProcessor.sendData();
}
Could you please let me know how to do this.
Thanks and Regards,
Pravu Mishra.
Hello Pravu,
how do you implement these two combos ?
If you use “combo” excell, the values are passed to server correctly as well as other values of changed rows.
If you initialize combos in some containers that are placed inside grid cells, you should use onChange event of the combo. You can set userdata or the row with combo with the selected value:
combo.attachEvent(“onChange”,function(){
grid.setUserData(id,“combo_value”,combo.getActualValue())
dp.setUpdated(id.true) /marks row as updated/
})
Hi Alex,
Following is part of my code.
Header
StringBuffer out= new StringBuffer("");
out.append("");
out.append("<column width=“100” type=“ed” align=“left” filter=“true” sort=“str” >coursesk");
out.append("");
out.append("<column width=“100” type=“ed” align=“left” filter=“true” sort=“str” >Code");
out.append("");
out.append("<column width=“100” type=“ed” align=“left” filter=“true” sort=“str” >Course");
out.append("");
out.append("<column width=“100” type=“combo” align=“left” filter=“true” sort=“str” xmlcontent=“1”>Faculty");
out.append(fetchCategoryCombo());
out.append("");
public String fetchCategoryCombo()throws ClassNotFoundException, SQLException{
ResultSet rs;
StringBuffer out= new StringBuffer("");
startConnect();
String sql = “select category_sk, category_id from acd_category”;
rs = stmt.executeQuery(sql);
while (rs.next()){
out.append("<option value="" + rs.getString(“category_sk”) + “”>" + rs.getString(“category_id”) +"");
}
closeConnect();
return out.toString();
}
data part of xml rows for combo
if(rs.getString(“category_desc”) != null)
out.append(""+convertEscapes(rs.getString(“category_desc”))+"");
else
out.append(""+""+"");
For this code the combo works. But the problem now is hidden value does not get passed if there is no click happened on the combo. If you click on the combo and select any value then the hidden value gets passed.
Could you please assist and provide your suggestion.
thanks and regards,
pravu Mishra.
Hello,
the Data Processor only sends data for changed rows. When you open editor and select new option, the grid value is changhed and data is sent to the server.
In order to send to the server the data from a certain row (chnaged or nor) you can use setUpdated method:
dp.setUpdated(rowId,true);
dp.sendData();