Инструмент для очистки (вложил) закрытие в JavaScript с jQuery каждый ()

Вам нужно

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")
6
задан Peter Hilton 16 January 2009 в 23:47
поделиться

1 ответ

Править: Этот ответ был релевантен в более старых версиях jQuery. В более новой версии $.map работы по-другому.

Проверьте $ .map () функция, используемая для выполнения той же операции на каждом элементе массива.

$('.moreinfodialog').map(function(idx, element) {
    $(this).prev("a").click(function() {
            $(element).dialog("open");
            return false;
    });
});
4
ответ дан 17 December 2019 в 07:09
поделиться
Другие вопросы по тегам:

Похожие вопросы: