I have a question regarding the question: enter link description here I added 'datatype:"local"' to my grid and it worked , i got the xml , but it did include inside of it the checkbox column i have in the grid. this is my code:
<script type="text/javascript" >
var MyExportToXml = function (grid)
{
var dataFromGrid = {row: grid.jqGrid ('getGridParam', 'data') };
var xmldata = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\n<rows>\n' +
xmlJsonClass.json2xml (dataFromGrid, '\t') + '</rows>';
alert(xmldata);
};
function checkboxFormatter(cellvalue, options, rowObject)
{
var _checkbox_name = options.colModel.name;
var _checkbox_name_id = _checkbox_name + options.rowId;
cellvalue = cellvalue + "";
cellvalue = cellvalue.toLowerCase();
var bchk = cellvalue.search(/(false|0|no|off|n)/i) < 0 ? " checked " : " ";
return "<input type='checkbox' id='"+_checkbox_name_id+"' onclick=\"\" " + bchk + " value='" + cellvalue + "' offval='no' />"
}
function myunformatfunc(cellvalue, options, rowObject)
{
alert(cellvalue);
return cellvalue;
}
jQuery("#confirm_payment").jqGrid({
url:'loadgrid.jsp?type=1',
datatype: "xml",
loadonce:true ,
direction:"rtl",
height: '100%',
width: '100%',
colNames:['test1' , 'test2' , 'test3' , 'test4'],
colModel:[
{name:'test1',xmlmap:'test1', width:18,align:"center",sortable:false ,edittype:"checkbox", formatter: checkboxFormatter ,unformat:myunformatfunc},
{name:'test2',xmlmap:'test2', width:18,align:"center",sortable:false ,edittype:"checkbox", formatter: checkboxFormatter ,unformat:myunformatfunc},
{name:'test3',xmlmap:'test3', width:80, align:"right",sorttype:"int"},
{name:'test4',xmlmap:'test4', width:70, align:"right",sorttype:"int"},
],
xmlReader: {
root:"payments",
row:"payment",
page:"payments>page",
total:"payments>total",
records:"payments>records",
repeatitems:false
},
multiselect: false,
autowidth: true,
forceFit: false,
shrinkToFit: false
});
</script>
how can i include the checkbox values inside the created xml? and if it isn't possible, Is there another way to get xml from my data inside the grid?
Thank's in advance.