This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.extenders.paging = function (target, pageSize) { | |
var _pageSize = ko.observable(pageSize || 10), // default pageSize to 10 | |
_currentPage = ko.observable(1); // default current page to 1 | |
target.pageSize = ko.computed({ | |
read: _pageSize, | |
write: function (newValue) { | |
if (newValue > 0) { | |
_pageSize(newValue); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ko.observableArray.fn.filterByProperty = function(propName, matchValue) { | |
return ko.computed(function() { | |
var allItems = this(), matchingItems = []; | |
for (var i = 0; i < allItems.length; i++) { | |
var current = allItems[i]; | |
if (ko.utils.unwrapObservable(current[propName]) === matchValue) | |
matchingItems.push(current); | |
} | |
return matchingItems; | |
}, this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var match = ko.utils.arrayFirst(self.dialogboxArray(), function(item) { | |
return newMessage.target === item.name; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(ths.value)) { | |
alert("你选择的不是图片文件"); | |
ths.value = ""; | |
return false; | |
} |
NewerOlder