Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unable to process binding
Message
De
07/07/2014 08:29:16
 
Information générale
Forum:
Javascript
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01603075
Message ID:
01603281
Vues:
61
Thanks Rick,

I tried it like that but get the same error.

Any more ideas? I am really stuck on this. :(


>If it's a property you need RunSheetDetailFilter().searchText as the expression with Knockout.
>
>Common mistake and one of the reasons I've abandoned Knockout sometime back for Angular.
>
>+++ Rick ---
>
>>Hi,
>>
>>first attempt at digging into some slightly complex javascript. I am getting this error:
>>
>>
Uncaught ReferenceError: Unable to process binding "value: function (){return RunSheetDetailFilter.searchText }"
>>
>>Not getting much hits when searching on this.
>>
>>Basically it sounds as if the function has not been defined correctly.
>>
>>This is the code in my cshtml file:
>>
>>
<input class="filter-box"
>>           data-bind="value: RunSheetDetailFilter.searchText, valueUpdate: 'afterkeydown', escape: clearFilter"
>>           placeholder="Filter by AWB#" type="text" />
>>
>>This is my filter.runsheetdetail.js file (I am following an example that uses require.js):
>>
>>
define('filter.runsheetdetails',
>>    ['ko', 'utils', 'config'],
>>    function (ko, utils, config) {
>>
>>    	var RunSheetDetailFilter = function () {
>>    		var self = this;
>>    		self.searchText = ko.observable().extend({ throttle: config.throttle });
>>    		return self;
>>    	};
>>
>>    	RunSheetDetailFilter.prototype = function () {
>>    		var tagDelimiter = '|',
>>                escapedTagDelimiter = '\\|',
>>                searchTest = function (searchText, runsheetdetail) {
>>                	if (!searchText) return true; // always succeeds if no search text
>>                	var srch = utils.regExEscape(searchText.toLowerCase());
>>                	if (runsheetdetail.awb_number().toLowerCase().search(srch) !== -1) return true;
>>                	return false;
>>                },
>>
>>                predicate = function (self, runsheetdetail) {
>>                	// Return true if all of these meet the filter criteria. Otherwise, return false
>>                	var match = searchTest(self.searchText(), runsheetdetail);
>>                	return match;
>>
>>                	//PAPA: testing only. 
>>                	//var matchSearch = searchTest(self.searchText(), session),
>>                	//    matchFav = favoriteTest(self.favoriteOnly(), session),
>>                	//    matchTime = timeSlotTest(self.minDate(), self.maxDate(), session),
>>                	//    matchModels = modelTest(self.timeslot(), self.speaker(), self.track(), session);
>>                	//console.log('search filter matched: ' + matchSearch);
>>                	//console.log('favorites filter matched: ' + matchFav);
>>                	//console.log('time filter matched: ' + matchTime);
>>                	//console.log('models filter matched: ' + matchModels);
>>                	//console.log('MATCH === ' + matchSearch && matchFav && matchTime && matchModels);
>>                	//return matchSearch && matchFav && matchTime && matchModels;
>>                };
>>
>>    		return {
>>    			predicate: predicate
>>    		};
>>    	}();
>>
>>    	return RunSheetDetailFilter;
>>    });
>>
>>Can anyone spot anything wrong in there?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform