Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Function expected error for knockout computed functions

$
0
0

Hi,

i am using Knockout table to get all list items from SharePoint List and trying to do live search on each column. I am getting function expected error at the highlighted code(error is "return statement is outside the function"). Please let me know is i miss anything from my code.

 self.requests = ko.observableArray([]);
            self.query = ko.observable("");
            self.Requests = ko.computed(function () {
            var filter = self.query().toLowerCase();
            if (filter) {
                return ko.utils.arrayFilter(self.requests(), function (item) {
                return (item.ID().toLowerCase().indexOf(filter) !== -1);
                });   
            }
           else {
            return self.requests();
           }
        }); 



Viewing all articles
Browse latest Browse all 7589

Trending Articles