javascript - knockout observableArray access -


how can send optionsserver server correctly ? cause i'm trying send values checked checkbox server.

my code:

var viewmodel = {};  viewmodel.ui = {};  viewmodel.ui.flashbackreport = {     choosenemails : ko.observablearray(),     choosenoptions : ko.observablearray(),     optionsserver :  ko.observablearray(),     options : ko.observablearray([ "new contacts", "updated contacts","verified contacts" ]),     optionstosend: ko.computed({         read : function () {             var viewmodelshortcut= viewmodel.ui.flashbackreport;             if (viewmodelshortcut.choosenoptions()=="new contacts")                 viewmodelshortcut.optionsserver.push('new');                else if (viewmodelshortcut.choosenoptions()=="updated contacts")                      viewmodelshortcut.optionsserver.push('better');               else if (viewmodelshortcut.choosenoptions()=="verified contacts")                    viewmodelshortcut.optionsserver.push('not_better');           /*   else if (viewmodelshortcut.choosenoptions()[0]=="new contacts"                       && viewmodelshortcut.choosenoptions()[1]=="updated contacts"                       && viewmodelshortcut.choosenoptions()[2]=="verified contacts")                  viewmodelshortcut.optionsserver.push('new','better','not_better');          */       },     deferevaluation: true }), 

this way works :

optionstosend: ko.computed({     read : function () {           console.info(viewmodel.ui.report.options()[0]);     },     deferevaluation: true }) 

see fiddle


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -