求最值: var selections = $("#deliveryGridSalesOrGoods").datagrid('getRows'); var costPrice = ''; var ecPrice=''; if (selections != null && selections != '') { for (var i = 0; i < selections.length; i++) { costPrice += selections[i].ecPrice-selections[i].costPrice+','; } } if(costPrice!=null){ costPrice = costPrice.substring(0, costPrice.lastIndexOf(",")); } if (selections != null && selections != '') { for (var i = 0; i < selections.length; i++) { ecPrice += selections[i].ecPrice+','; } } if(ecPrice!=null){ ecPrice = ecPrice.substring(0, ecPrice.lastIndexOf(",")); } var arry = new Array(); var newEc=costPrice.split(','); var newecPrice=ecPrice.split(',');// Number(value).toFixed(2); var ecmin=Math.min.apply(null, newEc).toFixed(2);;//最小值 var ec_price=Math.min.apply(null, newecPrice).toFixed(2);;//最小值