Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Cómo suspender y reactivar la propiedad para que funcione como se espera en knockout.js

Tengo una función setServiceId(serviceId) la que se llama haciendo clic en algún botón y estoy pasando la identificación de ese servicio.

También tengo serviceIdSubscrier = vm.selectedServiceId.supsendableSubscribe(changeServiceId) que escucha en cada cambio de serviceId (por ejemplo, si hice clic en id = 5151, y luego en 5152, este evento se activará y se llamará a una función changeServiceId ) Sin embargo, ahora, Quiero que cuando haga clic varias veces en el mismo servicio, también se active, ya que se activaría cuando las identificaciones son diferentes (por ejemplo, hice clic en la identificación del servicio = 5151, y luego nuevamente en la identificación = 5151) y me gustaría tener el mismo comportamiento ya que hice clic en diferentes identificaciones

estas son todas mis funciones:

 function setServiceId(serviceId) { vm.selectedServiceId(serviceId); jQuery.post(rootUrl + 'spaemployeeadmin/GetFirstSearchFilterDateForParent', { locationId: vm.selectedLocationId() }) .done(function (data) { var dateObj = { day: data.Day, month: data.Month, year: data.Year }; vm.refreshData(dateObj, null); }); }

serviceIdSubscrier = vm.selectedServiceId.supsendableSubscribe(changeServiceId)

 function changeServiceId() { var currentService = getService(); if (vm.combineSchedules()) { vm.selectedService(currentService || {}); refreshAllowedTimes().then(function () { setTimeByPreviousSelection(); checkToPushCriteria(); }); } else { refreshOnServiceType(); } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si serviceId fuera un objeto, podría cambiarlo a otro objeto con los mismos valores y se registraría un cambio.

 5 === 5 //True {id: 5} === {id: 5} //False
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!