success callback after knockout.js finishes rendering all the elements

后端 未结 8 1015
你的背包
你的背包 2020-12-01 04:39

I have implemented a knockout foreach binding, with multiple templates in the same page, one of the example is given here, what I am interested is in finding out when a bloc

相关标签:
8条回答
  • 2020-12-01 05:03

    Try wrapping the ul with

    <div data-bind='template: {afterRender: myPostProcessingLogic }'>
    

    It will only work the first time everything within the template is rendered. But you will only get the one call to myPostProcessingLogic. Here's a fiddle

    <div data-bind='template: {afterRender: myPostProcessingLogic }'>
      <ul data-bind="foreach: Contacts">
        <li>
          <div class="list_container gray_bg mrgT3px">
            <div class="list_contact_icon"></div>
            <div class="contact_name"><span data-bind="text: first_name"></span> <span data-bind="text: last_name"></span></div>
            <div class="contact_number"><span data-bind="text: value"></span></div>
            <div class="callsms_container">
              <a href="#notification-box" class="notifcation-window">
                <div class="hover_btn tooltip_call">
                  <div class="hover_call_icon"></div>
                  <span>Call</span></div>
              </a>
              <a class="sendsms" href="#sendsms" rel="#sendsms">
                <div class="hover_btn tooltip_sms">
                  <div class="hover_sms_icon"></div>
                  <span>SMS</span></div>
              </a>
              <a href="#">
                <div class="hover_more_btn"></div>
              </a>
            </div>
            <!-- close callsms container -->
            <div id="notification-box" class="notification-popup">
              <a href="#" class="close"><img class="btn_close" src="images/box_cross.png" /></a> <img class="centeralign" src="images/notification_call.png" /> <span>Calling... +44 7401 287366</span> </div>
            <!-- close notification box -->
            <!-- close list gray bg -->
            <div class="tooltip_description" style="display:none" id="disp"> asdsadaasdsad </div>
          </div>
        </li>
      </ul>
    </div>
    
    0 讨论(0)
  • 2020-12-01 05:06

    Try afterRenderAll callback in knockout.js:

    foreach: { data: myItems, afterRenderAll: myPostProcessingLogic }

    0 讨论(0)
提交回复
热议问题