Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

I am using knockuout js ,

I have one list item by oing foreach I am displaying month number ,
now from that month number i want to show month name short name.

<div data-bind="dxList: { dataSource: userDatasource_plan, autoPagingEnabled: true,onItemClick:onPlanUserSelectionClick, height : '80%'   }">
                 <div data-options="dxTemplate : { name: 'item' } ">
                     <div data-bind="text: UserID, visible:false"></div>
                     <div class="enqueryListCustomerName" data-bind="text: FullName"></div>
                     <div class="enqueryListCustomerType" data-bind="text: Division"></div>
                     <div class="enqueryListCustomerLocation" data-bind="text: Month"></div>
                 </div>
             </div>



Now insted of Month i want to use i want to call javascript function which will bring month prefix name ..

What I have tried:

var viewModel = {
title: ko.observable(Common.Localize('Plan')),
MonthName: ko.observable(function (param) {
var month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";
var n = month[param];
}),

but not sure how to call this function and how to pass paramter
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900