2015-02-11 57 views

回答

2

試試這個

{ 
    field: "Photo", 
    title: "Photo", 
    template: function(dataItem) { 
     return kendo.template(
      '<img src="#= Photo #" alt="image" width="80px" height="80px" />' 
     )({Photo: dataItem.Photo || 'http://path-to-image'}); 
    } 
    width: 100 
} 

dataItem.Proto || 'http://path-to-image'意味着如果Photo是falsy(nullfalse0''undefined),然後使用默認路徑

Example

+0

對不起,對於延遲reply.It工作:) @Alexander – Ironman 2015-02-11 15:01:45

1

簡單!

{ 
    field: "Photo", 
    title: "Photo", 
    template: '<img src="#= Photo == null ? "http://exemple.com/pic.jpg" : Photo #" alt="image" width="80px" height="80px" />', 
    width: 100 
} 
+0

這是可能與kendo listview的PHP。由於我設置了默認圖像,但它不起作用。 – 2017-02-10 14:07:44

相關問題