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

149
Views
En ViewModel vincula el valor con otro

Estoy usando Kendo JQuery con MVVM.

Me gustaría cambiar automáticamente el valor de una variable ("etiqueta") cuando cambia otra variable ("optionId").

Este es mi VieModel:

 var vm = kendo.observable({ optionId: '', label: ( this.optionId == 'Spaghetti' ? "Pasta selected" : "Animal selected" ), setOption: function( event ) { var value = event.currentTarget.value; this.set("optionId", value ); //this.set("label", this.optionId == 'Spaghetti' ? "Pasta selected" : "Animal" ); } });

Si elimino la línea comentada, funciona. Pero eso no es lo que quiero porque tendría que agregar esa línea en cada método.

Pensé que podría escribir:

 label: ( this.get("optionId") == etc... )

pero no puedo Creo que esto funcionaría.

Aquí hay un ejemplo en Kendo Dojo.

https://dojo.telerik.com/agewIWAk

Muchas gracias.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Aquí la solución, del foro de Telerik:

https://www.telerik.com/forums/in-viewmodel-binds-value-with-another

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!