jquery mobile - JQM/knockoutJS component popup doesn't bind data? -


i have simple popup want use in components. doesn't bind data on popup, in other parts of components does?

viewmodel

ko.components.register('customer-search', {     viewmodel: function(){     var self = this;      //data      self.search= ko.observable();      self.list= ko.observablearray([{supcode:"cho024",supname:"supplier"}]);      self.next= ko.observable();      self.prev= ko.observable();      self.testtext= ko.observable('test');      //general vars        ko.bindinghandlers.applyjquerymobilestuff = {       init: function(elem) {           $(elem).trigger("create");       }     }    },     template:       '<div class="customer-search" data-bind="applyjquerymobilestuff: true">\        <input type="text" data-bind="value: testtext"/><br>\          \          <a href="#popupsearch1" data-rel="popup" data-position-to="window" data-role="button" data-transition="slideup" id="test" data-dismissible="false">choose customer</a>\         <div data-role="popup" id="popupsearch1" data-overlay-theme="d" data-theme="a" class="ui-corner-all" style="max-width:600px;">\          <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-left">close</a>\             <div data-role="header" data-theme="b" class="ui-corner-top">\                 <h4>customer search</h4>\             </div>\            <div data-role="content" data-theme="d" class="ui-corner-bottom ui-content">\             <input type="text" name="searchsupplier" placeholder="customer name" data-bind="value: testtext"/>\           </div>\         </div>\     <\div>\          ' }); 

view

<div data-bind='component: { name: "customer-search"}'></div> 

just put in part of content

i found answer after lots , lots of reading.

 ko.bindinghandlers.applyjquerymobilestuff = { //refresh component load jqm fromat       init: function(elem, valueaccessor, allbindingsaccessor, data, context) {           //init logic         // make modified binding context, properties, , apply descendant elements         var innerbindingcontext = context.extend(valueaccessor);         ko.applybindingstodescendants(innerbindingcontext, elem);         $(elem).trigger("create");         // tell ko *not* bind descendants itself, otherwise bound twice         return { controlsdescendantbindings: true };           //doesn't bind data popup???       },       update: function(elem){           //update logic            alert('update bind');       }    }; 

creating custom bindings control descendant bindings


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -