list

  • function
2.0.4
 

Live binds a compute's can.List incrementally.

live.list(el, compute, render, context, parentNode, nodeList, falseyRender, list) 2.0.4

Live binds a compute's can.List incrementally.

Parameters

  1. el {HTMLElement}

    An html element to replace with the live-section.

  2. compute {*}

  3. render {function(index, index)}

    A function that when called with the incremental item to render and the index of the item in the list.

  4. context {Object}

    The this the render function will be called with.

  5. parentNode {HTMLElement}Optional

    An overwritable parentNode if el's parent is a documentFragment.

    Use

    can.view.live.list is used to setup incremental live-binding.

    // a compute that change's it's list
    var todos = can.compute(function(){
      return new Todo.List({page: can.route.attr("page")})
    })
    
    var placeholder = document.createTextNode(" ")
    $("ul#todos").append(placeholder)
    
    
    
    can.view.live.list(
      placeholder,
      todos,
      function(todo, index){
        return "<li>"+todo.attr("name")+"</li>"
      })
    
  6. nodeList {*}

  7. falseyRender {*}

  8. list {can.compute(getterSetter, context) | can.List}

    A can.List or can.compute whose value is a can.List.