Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
using durandal compose to add a view and creating multiple clones of that div, data binding is not working

i am using durandal compose to add a div to my page that i need to create clones of according to elements of select list, I got the div i want to to show multiple instances of in a seperate html file and called it with :

  <div id="QFieldsId" data-bind="compose:{ view:'shared/quot' }"></div>

this is showing the original div perfectly where is should be, note that this div uses binding from an .JS file for getting elements inside it , like this :

 <div class="form-group col-md-3" data-bind="validationElement: CCommission,visible: CCommissionVisible()">
<label for="CCommission" class="control-label required">CCommission</label>
<span class="form-control "
data-bind="visible: !editingCCommission(), text: global.formatAsDecimal(CCommission(),CCommissionDecimal()), click: editCCommission"></span>
<input type="number" class="form-control "
data-bind="visible: editingCCommission, value: CCommission hasFocus: editingCCommission" />
</div>

the field that is shown by the durandal compose is binded perfectly , but then i am using this in the javascript file to create clones according to the number of elements in a selectlist :

var qfieldId = 0;
 $("#IBList option").each(function () {
qfieldId ++;
var select = document.getElementById("quoteId");
var clone = select.cloneNode(true);
clone.setAttribute("id", "quoteId" + qfieldId);
document.getElementById("QFieldsId").appendChild(clone);
}); 

I used the qfieldId to have different Ids on the clones for later on to get the data inserted in them, and here is where my problems start! the clones were created of the original div but some of the fields like the one i stated before are not accessible for editing.. my guess is that the problem is with the data binding of the editingCCommission() but i am not sure of this. the field create for editing to insert the data , in the JS file they are created like this :

self.editingCCommission = ko.observable(false);
self.editCCommission = function () { return self.editingCCommission(true) };

i thought perhaps the problem is with the editCCommission always being false not true in the clones. i still couldn't wrap my head around it so tell me if anyone has an idea about this please. thank you!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda