Skip to main content

Posts

Showing posts from November, 2013

knockoutjs observablearray push by conditions

// Here observable array contain three objects. var entries = ko. observableArray ([     { id: '1' , name: "Anil" , age: '28' , type: "A" },     { id: '2' , name: "Kumar" , age: '27' , type: "B" },     { id: '3' , name: "Singh" , age: '29' , type: "C" } ]); var filterdStaus = ko.observable( 'Kushinagar' ); var match = ko.utils.arrayFirst(entries(), function (ech) {             return filterdStaus === ech.Status;     }); if (match) {     entries.push(entry); }

Computed observable in KnockoutJS CSS binding

Here is the code-sample for view code < p data-bind =" text: ClientName , style: { marginLeft: SaveAsDraft ? ‘30px’: ‘0px’} "></ p > If SaveAsDraft is true then icon status images visible margin-left to 30px otherwise visible to 0px. Here is the code-sample for view model code var  viewModel = function (Status) {     var self = this ;     self.Status = Status;     self.ClientName = ko.observable( ‘Anil Singh’ );     self.SaveAsDraft = ko.observable( false );     self.SaveAsDraft = ko.computed( function () {         if (self.Status == ‘ Draft’ ) {             return self.SaveAsDraft( true );                }     }, self); }; ko.applyBindings( new  viewModel());

Knockoutjs computed observable

Table of Contents  code-sample for view. code-sample for view model. Step 1 Here is the code-sample for view code < img class ="status" src ="~/Images/icon_status.png" data-bind =" visible: SaveAsDraft " /> < img class ="status" src ="~/Images/icon_status_red.png" data-bind =" visible: SaveAsError " /> If SaveAsDraft is true then icon status images visible otherwise not visible. If SaveAsError is true then icon status images visible otherwise not visible.  Step 2 Here is the code-sample for view model code var  viewModel = function (Status) {     var self = this ;     self.Status = Status;     self.SaveAsDraft = ko. observable ( false );     self.SaveAsError = ko.observable( false ) ;     self.SaveAsDraft = ko.computed( function () {         if (self.Status == window.itk.model.constant.Draft) {             return window.itk.mytime.viewmodel.

setup sencha touch 2 on windows 7

Hello everyone, I am going to share the basic steps for setup sencha touch in window 7. Right now, I am working on that please follow below links. https://docs.sencha.com/architect/3/getting_started/installation_setup.html https://docs.sencha.com/touch/2.4/getting_started/getting_started.html https://www.sencha.com/forum/showthread.php?245044-Installing-Sencha-Touch-SDK-on-Windows

Ajax JSON cross domain call to REST service

Hello everyone, I'm going to share the code-sample for  Ajax cross domain call to REST service with JSON Request. Keeping in mind, if you working on to call cross domain to REST service. Here server handle two requests each operations.    1. First one for verify the request is OK and return to 200.   2. Send one is revert back the response. You will have to think about the security issues and be careful before doing something like 'Access-Control-Allow-Origin: *' Always return the headers above, not just on OPTION requests. First needs it in the response from the POST. Table of Contents 1. In the step 1, we added the custom headers in the config file. 2. In the step 2, execute the ajax request. Step 1 : In this step, need to add  protocol section from web.config file.   < httpProtocol >    < customHeaders >     < add name = " Access-Control-Allow-Origin " value = " * " />     < add name = " Acce