Код: Выделить всё
$(function() {
$("#jsGrid").jsGrid({
pageButtonCount: 5,
deleteConfirm: "Do you really want to delete the client?",
controller: db,
fields: [
{ name: "Name", type: "text", width: 150 },
{ name: "Age", type: "number", width: 50 },
{ type: "control" }
]
});
});
Код: Выделить всё
(function() {
var db = {
loadData: function(filter) {
return $.grep(this.clients, function(client) {
return (!filter.Name || client.Name.indexOf(filter.Name) > -1)
&& (!filter.Age || client.Age === filter.Age)
&& (!filter.Address || client.Address.indexOf(filter.Address) > -1)
&& (!filter.Country || client.Country === filter.Country)
&& (filter.Married === undefined || client.Married === filter.Married);
});
},
insertItem: function(insertingClient) {
this.clients.push(insertingClient);
},
updateItem: function(updatingClient) { },
deleteItem: function(deletingClient) {
var clientIndex = $.inArray(deletingClient, this.clients);
this.clients.splice(clientIndex, 1);
}
};
window.db = db;
db.countries = [
{ Name: "", Id: 0 },
{ Name: "United States", Id: 1 },
];
db.clients = [
{
"Name": "Otto Clay",
"Age": 61,
},
{
"Name": "Connor Johnston",
"Age": 73,
}
];
}());
Что я Хочу:
Я хочу позвонить в $ Array в раздел Javascripts как контроллер: db .
ошибка: < /em>
Когда я использую контроллер: ', его возвращающий нулевой причин я не могу позвонить, как они называют по умолчанию из db.js`
Пожалуйста, помогите мне, как я могу позвонить Php $ переменной или $ array вместо контроллера: db в javascript
Подробнее здесь: https://stackoverflow.com/questions/364 ... -controlle
Мобильная версия