easyui datagrid columns field 如何支持一個或多個子屬性


  

//如果只需要一個子屬性從value出發
{field:'customer',title:'會員手機',width:100, formatter: function(value,row,index){ if (value.phone){ return value.phone; } else { return ''; } } },


//如果需要多個子屬性同時顯示(customer為一個類)從row出發
//自定義該類下屬性name為customerName
{field:'customerName',title:'昵稱',width:100,
            formatter: function(value,row,index){
                if (row.customer){
                    if(row.customer.name != '')
                        return row.customer.name;
                    else{
                        return '';
                    }
                } else {
                    return '';
                }
           }
        },
//自定義該類下屬性sex為customerSex
 {field:'inventorySex',title:'性別',width:100,
            formatter: function(value,row,index){
         if (row.customer){
                    if(row.customer.sex!= '')
                        return row.customer.sex;
                    else{
                        return '';
                    }
                } else {
                    return '';
                }

           }
        },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM