¡@

Home 

2014/10/16 ¤W¤È 12:10:10

jquery Programming Glossary: viewmodel

jQuery UI datepicker with Knockout.js

http://stackoverflow.com/questions/13629910/jquery-ui-datepicker-with-knockout-js

write this ko.utils.postJson form 0 self.beschikkingen var viewModel new beschikkingModel beschikkingsdatum beschikkingsnummer .. beschikkingsdatum beschikkingsnummer ko.applyBindings viewModel Activate jQuery Validation form .validate submitHandler viewModel.save.. Activate jQuery Validation form .validate submitHandler viewModel.save Datepicker window .load function '.beschikkingsdatum'..

ASP.NET MVC Partial view ajax post?

http://stackoverflow.com/questions/14667274/asp-net-mvc-partial-view-ajax-post

public ActionResult _AddCategory CategoriesViewModel viewModel if success DbOperations... return RedirectToAction Categories.. else model state is not valid... return PartialView viewModel Question If operation is success I expect that redirect to.. public ActionResult _AddCategory CategoriesViewModel viewModel if success DbOperations... return Json new redirectTo Url.Action..

MVC 4 Edit modal form using Bootstrap

http://stackoverflow.com/questions/16011151/mvc-4-edit-modal-form-using-bootstrap

the modal public ActionResult EditPerson int id var viewModel new EditPersonViewModel viewModel.Id id return PartialView _EditPersonPartial.. EditPerson int id var viewModel new EditPersonViewModel viewModel.Id id return PartialView _EditPersonPartial viewModel HttpPost.. viewModel.Id id return PartialView _EditPersonPartial viewModel HttpPost this action takes the viewModel from the modal public..

How to update a JSON Object that is represented in a form

http://stackoverflow.com/questions/17221278/how-to-update-a-json-object-that-is-represented-in-a-form

view model via the mapping plugin replace the creation of viewModel in the code above with the ko.mapping.fromJS function var viewModel.. in the code above with the ko.mapping.fromJS function var viewModel ko.mapping.fromJS data This automatically creates observable.. data from the server you can update all the properties on viewModel in one step by calling the ko.mapping.fromJS function again..

Submit json to MVC3 action

http://stackoverflow.com/questions/6036297/submit-json-to-mvc3-action

server. I tried ko.utils.postJson location.href ko.toJSON viewModel But the object was blank when it hit the server. I switched.. this code .ajax url location.href type POST data ko.toJSON viewModel datatype json contentType application json charset utf 8 success..

Bind template item to the index of the array in KnockoutJS

http://stackoverflow.com/questions/6047713/bind-template-item-to-the-index-of-the-array-in-knockoutjs

html div data bind attr id 'item' ko.utils.arrayIndexOf viewModel.items data input data bind value name div script Edit these.. item. Like attach index to items whenever array changes viewModel.tasks.subscribe function var tasks this.tasks for var i 0 j.. task.index task.index ko.observable i else task.index i viewModel Sample here http jsfiddle.net rniemeyer CXBFN or you can take..

Autocomplete combobox with Knockout JS template / JQuery

http://stackoverflow.com/questions/7537002/autocomplete-combobox-with-knockout-js-template-jquery

init function element valueAccessor allBindingsAccessor viewModel var options valueAccessor allBindings allBindingsAccessor .. update function element valueAccessor allBindingsAccessor viewModel update value based on a model change var allBindings allBindingsAccessor..

large arrays in dependent observables - cascading

http://stackoverflow.com/questions/9070929/large-arrays-in-dependent-observables-cascading

messages which I need to get rid of. Here's some code viewModel.BottomLevelList ko.dependentObservable function if this.ParentList.. based on some further logic else continue return result viewModel I have tried using various setTimeout techniques from SO to..

KnockoutJS subscribe to property changes with Mapping Plugin

http://stackoverflow.com/questions/10143682/knockoutjs-subscribe-to-property-changes-with-mapping-plugin

over all browsers except IE7 and below. Here I take a viewmodel as an argument and try to reflect on it subscribing to the properties..

knockout data-bind on dynamically generated elements

http://stackoverflow.com/questions/11066732/knockout-data-bind-on-dynamically-generated-elements

you add this element on the fly after you have bound your viewmodel it will not be in the viewmodel and won't update. You can do.. after you have bound your viewmodel it will not be in the viewmodel and won't update. You can do one of two things. Add the element.. the beginning and leave the options collection in your viewmodel empty. Knockout won't render it until you add elements to options..

Can jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC?

http://stackoverflow.com/questions/1160669/can-jquery-do-a-post-of-a-viewmodel-to-a-controller-in-asp-net-mvc

and still get the same behavior jquery asp.net mvc ajax viewmodel share improve this question It is possible there is no difference..

performance / templating issues when using requirejs with JQuery, jQuery Mobile, Knockout and Sammy to build a structured app with External Templates

http://stackoverflow.com/questions/13469143/performance-templating-issues-when-using-requirejs-with-jquery-jquery-mobile

MVC Authentication and Antiforgery token with Durandal SPA template

http://stackoverflow.com/questions/15829657/mvc-authentication-and-antiforgery-token-with-durandal-spa-template

they are not authorized and navigates user to a login view viewmodel where they can enter details and try logging in. Some questions..

How to use the jQuery Validation plugin with metadata, jQuery Forms and xVal together?

http://stackoverflow.com/questions/1996125/how-to-use-the-jquery-validation-plugin-with-metadata-jquery-forms-and-xval-tog

from these calls to be something like a standardized viewmodel shell where you have the response specific content wrapped in..

Submit json to MVC3 action

http://stackoverflow.com/questions/6036297/submit-json-to-mvc3-action

When the user presses the submit button I convert the viewmodel back in a model and am trying to submit to the server. I tried..

knockoutjs unit testing with qunit

http://stackoverflow.com/questions/6331789/knockoutjs-unit-testing-with-qunit

code say if you are serializing from asp.net mvc into a viewmodel variable that sits in an actual page rather than in a testrunner..

Return a List<E> from a view in view model

http://stackoverflow.com/questions/6765424/return-a-liste-from-a-view-in-view-model

know. Thank you. jquery asp.net mvc asp.net mvc 3 razor viewmodel share improve this question Here's one technique that you..

Submit form with Enter key? [duplicate]

http://stackoverflow.com/questions/8981637/submit-form-with-enter-key

Can jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC?

http://stackoverflow.com/questions/1160669/can-jquery-do-a-post-of-a-viewmodel-to-a-controller-in-asp-net-mvc

jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC I have my Html Textboxes created.. when posting back to the server. Html.TextBox CustomerFormViewModel.Email This works great if it's a traditional POST. I can then.. public ActionResult AddCustomer CustomersFormViewModel model validate data save customer handle validation errors.....

Validate DropDown using Jquery in MVC3

http://stackoverflow.com/questions/15765086/validate-dropdown-using-jquery-in-mvc3

in that i want validate control form particular DIV ViewModel public class NewStreamViewModel public NewStreamViewModel .. form particular DIV ViewModel public class NewStreamViewModel public NewStreamViewModel this.Streams new List SelectListItem.. ViewModel public class NewStreamViewModel public NewStreamViewModel this.Streams new List SelectListItem this.Subjects new List..

JQuery 1.5 breaks Compare Validate (JQuery Validate 1.8)

http://stackoverflow.com/questions/5117458/jquery-1-5-breaks-compare-validate-jquery-validate-1-8

validation fails. I'm using JQuery.Validate 1.7. My ViewModel has the following data annotations summary Gets or sets the..

Return a List<E> from a view in view model

http://stackoverflow.com/questions/6765424/return-a-liste-from-a-view-in-view-model

This is my situation I have this view model public class ViewModel public DateTime someDate get set public String someString get.. text and then select from a list of E any number of E. The ViewModel returned in the action must have the date the text and contain.. achieve this. Let's start with the view model public class ViewModel public DateTime SomeDate get set public string SomeString get..

jQuery UI datepicker with Knockout.js

http://stackoverflow.com/questions/13629910/jquery-ui-datepicker-with-knockout-js

To actually transmit to server as a regular form post write this ko.utils.postJson form 0 self.beschikkingen var viewModel new beschikkingModel beschikkingsdatum beschikkingsnummer ko.applyBindings viewModel Activate jQuery Validation form .validate.. form 0 self.beschikkingen var viewModel new beschikkingModel beschikkingsdatum beschikkingsnummer ko.applyBindings viewModel Activate jQuery Validation form .validate submitHandler viewModel.save Datepicker window .load function '.beschikkingsdatum'.. beschikkingsnummer ko.applyBindings viewModel Activate jQuery Validation form .validate submitHandler viewModel.save Datepicker window .load function '.beschikkingsdatum' .datepicker dateFormat 'dd mm yy' constrainInput false jquery..

ASP.NET MVC Partial view ajax post?

http://stackoverflow.com/questions/14667274/asp-net-mvc-partial-view-ajax-post

script @using Html.BeginForm form elements Controller HttpPost public ActionResult _AddCategory CategoriesViewModel viewModel if success DbOperations... return RedirectToAction Categories else model state is not valid... return PartialView viewModel.. if success DbOperations... return RedirectToAction Categories else model state is not valid... return PartialView viewModel Question If operation is success I expect that redirect to another page Categories . But no action no error message. If.. return the url you want to redirect to as a JsonResult HttpPost public ActionResult _AddCategory CategoriesViewModel viewModel if success DbOperations... return Json new redirectTo Url.Action Categories else model state is not valid... return PartialView..

MVC 4 Edit modal form using Bootstrap

http://stackoverflow.com/questions/16011151/mvc-4-edit-modal-form-using-bootstrap

HttpGet this action result returns the partial containing the modal public ActionResult EditPerson int id var viewModel new EditPersonViewModel viewModel.Id id return PartialView _EditPersonPartial viewModel HttpPost this action takes the viewModel.. returns the partial containing the modal public ActionResult EditPerson int id var viewModel new EditPersonViewModel viewModel.Id id return PartialView _EditPersonPartial viewModel HttpPost this action takes the viewModel from the modal public ActionResult.. EditPerson int id var viewModel new EditPersonViewModel viewModel.Id id return PartialView _EditPersonPartial viewModel HttpPost this action takes the viewModel from the modal public ActionResult EditPerson EditPersonViewModel viewModel if..

How to update a JSON Object that is represented in a form

http://stackoverflow.com/questions/17221278/how-to-update-a-json-object-that-is-represented-in-a-form

plugins mapping.html Example Using ko.mapping To create a view model via the mapping plugin replace the creation of viewModel in the code above with the ko.mapping.fromJS function var viewModel ko.mapping.fromJS data This automatically creates observable.. via the mapping plugin replace the creation of viewModel in the code above with the ko.mapping.fromJS function var viewModel ko.mapping.fromJS data This automatically creates observable properties for each of the properties on data. Then every time.. of the properties on data. Then every time you receive new data from the server you can update all the properties on viewModel in one step by calling the ko.mapping.fromJS function again ko.mapping.fromJS data viewModel Hopefully this helps. share..

Submit json to MVC3 action

http://stackoverflow.com/questions/6036297/submit-json-to-mvc3-action

the viewmodel back in a model and am trying to submit to the server. I tried ko.utils.postJson location.href ko.toJSON viewModel But the object was blank when it hit the server. I switched to this code .ajax url location.href type POST data ko.toJSON.. the object was blank when it hit the server. I switched to this code .ajax url location.href type POST data ko.toJSON viewModel datatype json contentType application json charset utf 8 success function data alert success error function data alert error..

Bind template item to the index of the array in KnockoutJS

http://stackoverflow.com/questions/6047713/bind-template-item-to-the-index-of-the-array-in-knockoutjs

click addItem Add Item button script id itemTmpl type text html div data bind attr id 'item' ko.utils.arrayIndexOf viewModel.items data input data bind value name div script Edit these days I prefer to create a subscription to my observableArray.. through the array and create set an index observable on the item. Like attach index to items whenever array changes viewModel.tasks.subscribe function var tasks this.tasks for var i 0 j tasks.length i j i var task tasks i if task.index task.index.. for var i 0 j tasks.length i j i var task tasks i if task.index task.index ko.observable i else task.index i viewModel Sample here http jsfiddle.net rniemeyer CXBFN or you can take this idea and extend observableArrays to provide an indexed..

Autocomplete combobox with Knockout JS template / JQuery

http://stackoverflow.com/questions/7537002/autocomplete-combobox-with-knockout-js-template-jquery

the property to use for the value ko.bindingHandlers.jqAuto init function element valueAccessor allBindingsAccessor viewModel var options valueAccessor allBindings allBindingsAccessor unwrap ko.utils.unwrapObservable modelValue allBindings.jqAutoValue.. initialize autocomplete element .autocomplete options update function element valueAccessor allBindingsAccessor viewModel update value based on a model change var allBindings allBindingsAccessor unwrap ko.utils.unwrapObservable modelValue unwrap..

large arrays in dependent observables - cascading

http://stackoverflow.com/questions/9070929/large-arrays-in-dependent-observables-cascading

. the problem is in IE I'm getting long running script warning messages which I need to get rid of. Here's some code viewModel.BottomLevelList ko.dependentObservable function if this.ParentList .length 0 nothing selected return var result var i.. this.ParentList .Contains loop item then put in return list based on some further logic else continue return result viewModel I have tried using various setTimeout techniques from SO to break the large array up and return control momentarily to the..

KnockoutJS subscribe to property changes with Mapping Plugin

http://stackoverflow.com/questions/10143682/knockoutjs-subscribe-to-property-changes-with-mapping-plugin

that does this but it may not be the best approach. It works over all browsers except IE7 and below. Here I take a viewmodel as an argument and try to reflect on it subscribing to the properties function subscribeToKO data .each data function property..

knockout data-bind on dynamically generated elements

http://stackoverflow.com/questions/11066732/knockout-data-bind-on-dynamically-generated-elements

jquery knockout.js share improve this question If you add this element on the fly after you have bound your viewmodel it will not be in the viewmodel and won't update. You can do one of two things. Add the element to the DOM and re bind it.. improve this question If you add this element on the fly after you have bound your viewmodel it will not be in the viewmodel and won't update. You can do one of two things. Add the element to the DOM and re bind it by calling ko.applyBindings again..

Can jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC?

http://stackoverflow.com/questions/1160669/can-jquery-do-a-post-of-a-viewmodel-to-a-controller-in-asp-net-mvc

I want to know is it possible to do the POST via jQuery and still get the same behavior jquery asp.net mvc ajax viewmodel share improve this question It is possible there is no difference between a traditional POST and AJAX Post . For example..

performance / templating issues when using requirejs with JQuery, jQuery Mobile, Knockout and Sammy to build a structured app with External Templates

http://stackoverflow.com/questions/13469143/performance-templating-issues-when-using-requirejs-with-jquery-jquery-mobile

MVC Authentication and Antiforgery token with Durandal SPA template

http://stackoverflow.com/questions/15829657/mvc-authentication-and-antiforgery-token-with-durandal-spa-template

router.navigateTo '# user login' It warns the user they are not authorized and navigates user to a login view viewmodel where they can enter details and try logging in. Some questions that come to mind when building this authentication viewModel..

How to use the jQuery Validation plugin with metadata, jQuery Forms and xVal together?

http://stackoverflow.com/questions/1996125/how-to-use-the-jquery-validation-plugin-with-metadata-jquery-forms-and-xval-tog

server side method returns. You'll want the JSON that's returned from these calls to be something like a standardized viewmodel shell where you have the response specific content wrapped in a more standardized piece that exposes the information you..

Submit json to MVC3 action

http://stackoverflow.com/questions/6036297/submit-json-to-mvc3-action

json to MVC3 action I have a form created with Knockout.js. When the user presses the submit button I convert the viewmodel back in a model and am trying to submit to the server. I tried ko.utils.postJson location.href ko.toJSON viewModel But the..

knockoutjs unit testing with qunit

http://stackoverflow.com/questions/6331789/knockoutjs-unit-testing-with-qunit

to ask next was how would you then move this to production code say if you are serializing from asp.net mvc into a viewmodel variable that sits in an actual page rather than in a testrunner page. jquery unit testing knockout.js qunit share improve..

Return a List<E> from a view in view model

http://stackoverflow.com/questions/6765424/return-a-liste-from-a-view-in-view-model

my form posts. If I am not making myself clear please let me know. Thank you. jquery asp.net mvc asp.net mvc 3 razor viewmodel share improve this question Here's one technique that you could use to achieve this. Let's start with the view model..

Submit form with Enter key? [duplicate]

http://stackoverflow.com/questions/8981637/submit-form-with-enter-key

Can jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC?

http://stackoverflow.com/questions/1160669/can-jquery-do-a-post-of-a-viewmodel-to-a-controller-in-asp-net-mvc

jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC I have my Html Textboxes created so that they will be bound to a custom view model when.. created so that they will be bound to a custom view model when posting back to the server. Html.TextBox CustomerFormViewModel.Email This works great if it's a traditional POST. I can then receive it on the Controller side with something like this.. the Controller side with something like this AcceptVerbs HttpVerbs.Post public ActionResult AddCustomer CustomersFormViewModel model validate data save customer handle validation errors... I want to know is it possible to do the POST via jQuery and..

Validate DropDown using Jquery in MVC3

http://stackoverflow.com/questions/15765086/validate-dropdown-using-jquery-in-mvc3

using Jquery in MVC3 i have implement simple MVC3 application in that i want validate control form particular DIV ViewModel public class NewStreamViewModel public NewStreamViewModel this.Streams new List SelectListItem this.Subjects new List.. implement simple MVC3 application in that i want validate control form particular DIV ViewModel public class NewStreamViewModel public NewStreamViewModel this.Streams new List SelectListItem this.Subjects new List SelectListItem this.Languages.. in that i want validate control form particular DIV ViewModel public class NewStreamViewModel public NewStreamViewModel this.Streams new List SelectListItem this.Subjects new List SelectListItem this.Languages new List SelectListItem Display..

JQuery 1.5 breaks Compare Validate (JQuery Validate 1.8)

http://stackoverflow.com/questions/5117458/jquery-1-5-breaks-compare-validate-jquery-validate-1-8

1.8 After upgrading to JQuery 1.5 and later 1.5.1 my compare validation fails. I'm using JQuery.Validate 1.7. My ViewModel has the following data annotations summary Gets or sets the full name. summary value The full name. value Required Display..

Return a List<E> from a view in view model

http://stackoverflow.com/questions/6765424/return-a-liste-from-a-view-in-view-model

a List E from a view in view model This is my situation I have this view model public class ViewModel public DateTime someDate get set public String someString get set public List E someList get set What I have to do is in.. What I have to do is in the view set the date write some text and then select from a list of E any number of E. The ViewModel returned in the action must have the date the text and contain the list of selected items. What I need to know is how to.. this question Here's one technique that you could use to achieve this. Let's start with the view model public class ViewModel public DateTime SomeDate get set public string SomeString get set public List E SomeList get set public class E public bool..