• <small id='0INEv'></small><noframes id='0INEv'>

        <i id='0INEv'><tr id='0INEv'><dt id='0INEv'><q id='0INEv'><span id='0INEv'><b id='0INEv'><form id='0INEv'><ins id='0INEv'></ins><ul id='0INEv'></ul><sub id='0INEv'></sub></form><legend id='0INEv'></legend><bdo id='0INEv'><pre id='0INEv'><center id='0INEv'></center></pre></bdo></b><th id='0INEv'></th></span></q></dt></tr></i><div id='0INEv'><tfoot id='0INEv'></tfoot><dl id='0INEv'><fieldset id='0INEv'></fieldset></dl></div>
      1. <legend id='0INEv'><style id='0INEv'><dir id='0INEv'><q id='0INEv'></q></dir></style></legend>
        • <bdo id='0INEv'></bdo><ul id='0INEv'></ul>

        <tfoot id='0INEv'></tfoot>

        knockout.js - 模式的延迟数据绑定?

        时间:2023-09-04
        <i id='5p7xP'><tr id='5p7xP'><dt id='5p7xP'><q id='5p7xP'><span id='5p7xP'><b id='5p7xP'><form id='5p7xP'><ins id='5p7xP'></ins><ul id='5p7xP'></ul><sub id='5p7xP'></sub></form><legend id='5p7xP'></legend><bdo id='5p7xP'><pre id='5p7xP'><center id='5p7xP'></center></pre></bdo></b><th id='5p7xP'></th></span></q></dt></tr></i><div id='5p7xP'><tfoot id='5p7xP'></tfoot><dl id='5p7xP'><fieldset id='5p7xP'></fieldset></dl></div>

        <small id='5p7xP'></small><noframes id='5p7xP'>

          <legend id='5p7xP'><style id='5p7xP'><dir id='5p7xP'><q id='5p7xP'></q></dir></style></legend>
        1. <tfoot id='5p7xP'></tfoot>
              <tbody id='5p7xP'></tbody>

                • <bdo id='5p7xP'></bdo><ul id='5p7xP'></ul>

                • 本文介绍了knockout.js - 模式的延迟数据绑定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在使用 knockout.js 来显示员工列表.我在页面上有一个隐藏的模式标记.当单击单个员工的详细信息"按钮时,我想将该员工数据绑定到模式弹出窗口.我正在使用 ko.applyBindings(employee, element) 但问题是当页面加载时,它期望模态开始时绑定到某些东西.

                  I am using knockout.js to display a list of employees. I have a single hidden modal markup on the page. When the "details" button for a single employees is clicked, I want to data-bind that employee to the modal popup. I am using the ko.applyBindings(employee, element) but the problem is when the page loads, it is expecting the modal to start off as bound to something.

                  所以我想知道,是否有技巧/策略来进行延迟/延迟数据绑定?我查看了虚拟绑定,但文档没有足够的帮助.

                  So I'm wondering, is there a trick/strategy to do a late/deferred databinding? I looked into virtual bindings but the documentation was not helpful enough.

                  谢谢!

                  推荐答案

                  我会创建另一个包裹员工的 observable.

                  I would create another observable that wraps the employee.

                  this.detailedEmployee = ko.observable({}),
                  
                  var self = this;
                  this.showDetails = function(employee){
                      self.detailedEmployee(employee);
                      $("#dialog").dialog("show"); //or however your dialog works
                  }
                  

                  将点击附加到 showDetails.然后你可以在页面加载时调用 applyBindings.

                  Attach the click to showDetails. Then you can just call applyBindings on page load.

                  这篇关于knockout.js - 模式的延迟数据绑定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何从 javascript 打开 jQuery Mobile 对话框? 下一篇:如何更改 jQuery UI 对话框的背景颜色?

                  相关文章

                  最新文章

                  <small id='0AjvN'></small><noframes id='0AjvN'>

                    <i id='0AjvN'><tr id='0AjvN'><dt id='0AjvN'><q id='0AjvN'><span id='0AjvN'><b id='0AjvN'><form id='0AjvN'><ins id='0AjvN'></ins><ul id='0AjvN'></ul><sub id='0AjvN'></sub></form><legend id='0AjvN'></legend><bdo id='0AjvN'><pre id='0AjvN'><center id='0AjvN'></center></pre></bdo></b><th id='0AjvN'></th></span></q></dt></tr></i><div id='0AjvN'><tfoot id='0AjvN'></tfoot><dl id='0AjvN'><fieldset id='0AjvN'></fieldset></dl></div>

                    <tfoot id='0AjvN'></tfoot>
                    • <bdo id='0AjvN'></bdo><ul id='0AjvN'></ul>
                  1. <legend id='0AjvN'><style id='0AjvN'><dir id='0AjvN'><q id='0AjvN'></q></dir></style></legend>