Authored by chenchao

use method 2 build html

@@ -27,7 +27,28 @@ var promotionEdit={ @@ -27,7 +27,28 @@ var promotionEdit={
27 return _checkBox; 27 return _checkBox;
28 }, 28 },
29 getParam:function(){ 29 getParam:function(){
30 - var batchIds=this.batchIds; 30 +
  31 + var _buildCheckboxHtml =
  32 + function (item) {
  33 + var htmlContent = "";
  34 + var _class="wqt_checkbox";
  35 + if(this.batchIds.length === 0 ){
  36 + //htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
  37 + htmlContent = this.buildCheckboxHtml(_class,item.__index);
  38 + }else{
  39 + $.each(this.batchIds,function(n,value) {
  40 + if(item.id == value){
  41 + //htmlContent = "<input type='checkbox' checked='checked' class='wqt_checkbox' data-index='"+item.__index+"'>";
  42 + htmlContent = this.buildCheckboxHtml(_class,item.__index,"checked");
  43 + return false
  44 + }else{
  45 + htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
  46 + htmlContent = this.buildCheckboxHtml(_class,item.__index);
  47 + }
  48 + })
  49 + }
  50 + return htmlContent;
  51 + };
31 var param={ 52 var param={
32 el: '#basicTable_promotion', 53 el: '#basicTable_promotion',
33 size: 10, 54 size: 10,
@@ -43,24 +64,7 @@ var promotionEdit={ @@ -43,24 +64,7 @@ var promotionEdit={
43 display: '', 64 display: '',
44 type: 'checkbox', 65 type: 'checkbox',
45 render: function (item) { 66 render: function (item) {
46 - var htmlContent = "";  
47 - var _class="wqt_checkbox";  
48 - if(batchIds.length == 0 ){  
49 - htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";  
50 - //htmlContent = this.buildCheckboxHtml(_class,item.__index);  
51 - }else{  
52 - $.each(batchIds,function(n,value) {  
53 - if(item.id == value){  
54 - htmlContent = "<input type='checkbox' checked='checked' class='wqt_checkbox' data-index='"+item.__index+"'>";  
55 - //htmlContent = this.buildCheckboxHtml(_class,item.__index,"checked");  
56 - return false  
57 - }else{  
58 - htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";  
59 - //htmlContent = this.buildCheckboxHtml(_class,item.__index);  
60 - }  
61 - })  
62 - }  
63 - return htmlContent; 67 + return _buildCheckboxHtml(item);
64 } 68 }
65 },{ 69 },{
66 display: "ID", 70 display: "ID",