How to display No Data when observable array is empty?

后端 未结 2 1147
庸人自扰
庸人自扰 2021-01-18 00:21

I\'m new to Knockout.js and I\'m trying to display data from observable array to a table. The problem I have is it generates two tbody tags. But if

2条回答
  •  无人及你
    2021-01-18 00:38

    When doing this we make a lot of use of virtual elements. They are outlined here http://knockoutjs.com/documentation/if-binding.html#note_using_if_without_a_container_element

    The rest of your markup is fine, but you could wrap your first tbody in a virtual element like this:

    
        
            
                
                
                
                
            
        
    
    

    JSFiddle here: http://jsfiddle.net/ZKWMh/

提交回复
热议问题