上会写的Flexigrid折行显示时,获取值有问题,报错。
getRows: function(){ //add by jej var rtnList = new Array(); var objRows = $('.trSelected', $(t)); if(objRows!=null){ for(var i=0;i<objRows.length;i++){ var row = objRows[i]; var rowMap = new Object(); for(var j=0;j<row.cells.length;j++){ var cellName = p.colModel[j].name; var value = row.cells[j].innerText; value=value.replace(/^ +| +$/g,""); value=value.replace(/ +/g,""); var s = "rowMap." + cellName + '="'+ value + '"'; eval(s); } rtnList[rtnList.length] = rowMap; } } return rtnList; },
需要在【这行只去掉前后的回车符】
value=value.replace(/^ +| +$/g,"");
行下增加
value=value.replace(/ +/g,"");
分开的原因是便于扩充,能够替换成想要的字符,