Вам нужно
var allUsers = [User]()
var currentUsers = [User]()
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return currentUsers.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell")!
cell.textLabel?.text = "this cell index for \(currentUsers[indexPath.row].username) "
return cell
}
@IBAction func ActionShowActiveUsers(_ sender: Any) {
currentUsers = users.filter {[110].active}
print(currentUsers.count)
tableView.reloadData()
}
@IBAction func btnShowInActiveUser(_ sender: Any) {
currentUsers = users.filter { ![110].active }
print(currentUsers.count)
tableView.reloadData()
}
Добавить это в viewDidLoad
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
Править: Этот ответ был релевантен в более старых версиях jQuery. В более новой версии $.map
работы по-другому.
Проверьте $ .map () функция, используемая для выполнения той же операции на каждом элементе массива.
$('.moreinfodialog').map(function(idx, element) {
$(this).prev("a").click(function() {
$(element).dialog("open");
return false;
});
});