how to get event when knockout binding is done

2019-05-23 21:23发布

I have a problem with jquery selectmenu plugin and knockout binding. In short, I need to call selectmenu after knockout binding is done. How do I know binding of certain html element is done?

1条回答
做个烂人
2楼-- · 2019-05-23 21:52

You can use afterrender event for doing anything after rendering the template.

      <div data-bind='template: { name: "personTemplate",  data: myData, afterRender: myPostProcessingLogic }'> </div>

      viewModel.myPostProcessingLogic = function(elements)            
       {            
             //You can add custom post-processing logic here           
       }
查看更多
登录 后发表回答