小编And*_*rew的帖子

从选项中过滤列中的数据使用 jQuery

我使用过滤,但我有问题,我有 4 个选项输入,其中我有一些数据需要在表中过滤,现在我只过滤一列的数据,但问题是我是否会再添加一个过滤器,脚本将不起作用,并从最后选择的值过滤数据。但是如果我在选项数据中有 2-4 个选定的值,我需要过滤。

我的代码:JS:

$("#cancelFilters").hide();

$('#filterButton').click(function () {
    getSelectedVal()
    filterData()
    filters = [];
    $("#cancelFilters").fadeIn();
});

var filters = [];

function getSelectedVal() {
    var materialCode = $('#materialCode option:selected').text()
    var plantCode = $('#plantCode option:selected').text()
    var vsCode = $('#vsCode option:selected').text()
    var status = $('#statusCode option:selected').text()

    applyFilter(materialCode, 1)
    applyFilter(plantCode, 2)
    applyFilter(vsCode, 3)
    applyFilter(status, 4)
}

function applyFilter(value, id) {
    if (value)
        filters.push('.column' + id + ':contains(' + value + ')');
}


function filterData() {
    if (filters.length > 0) {
        var rows = …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

5
推荐指数
0
解决办法
59
查看次数

iOS 如何创建倒计时时间 [小时、分钟、秒] Swift 4

我想创建倒计时时间,但我找不到这样的信息,我该怎么做。

例如我有200 分钟它是3,3 小时

对于这3,3 小时我想要倒计时,我可以在标签上看到这些信息吗?

我怎么能做到这一点?

我在论坛上找到了这样的代码:

func startTimer() {

    let releaseDateString = "03:33:00"
    let releaseDateFormatter = DateFormatter()
    releaseDateFormatter.dateFormat = "HH:mm:ss"
    releaseDate = releaseDateFormatter.date(from: releaseDateString)! as NSDate

    countdownTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateTime), userInfo: nil, repeats: true)
}

@objc func updateTime() {

    let currentDate = Date()
    let calendar = Calendar.current

    let diffDateComponents = calendar.dateComponents([.hour, .minute, .second], from: currentDate, to: releaseDate! as Date)

    let countdown = "Hours \(diffDateComponents.hour ?? 0), Minutes \(diffDateComponents.minute ?? …
Run Code Online (Sandbox Code Playgroud)

timer ios swift

3
推荐指数
1
解决办法
3021
查看次数

iOS - 从数组中获取第一个非空字符串元素

我有阵列:

let array = ["", "Therapeutic Dentistry","Surgical Dentistry","Orthopedic Dentistry","Orthodontics","Genaral Medical Questions","Children Therapeutic Dentistry","Children Surgical Dentistry"]
Run Code Online (Sandbox Code Playgroud)

我想要第一个,它是空的,我怎么能从数组中获取这个元素?

arrays ios swift

1
推荐指数
1
解决办法
182
查看次数

iOS如何以编程方式重新启动应用程序Swift 4

我遇到问题,更改语言后,我想重新启动应用程序。

所以,我想提醒消息的文字“ 你要重新启动应用程序更改语言吗? ”“ ”“

如果用户按YES,我如何重新启动应用程序?

我的解决方案:

 let alertController = UIAlertController(title: "Language".localized(), message: "To changing language you need to restart application, do you want to restart?".localized(), preferredStyle: .alert)
    let okAction = UIAlertAction(title: "Yes".localized(), style: UIAlertActionStyle.default) {
        UIAlertAction in
        NSLog("OK Pressed")
        exit(0)
    }
    let cancelAction = UIAlertAction(title: "Restart later".localized(), style: UIAlertActionStyle.cancel) {
        UIAlertAction in
        NSLog("Cancel Pressed")
    }
    alertController.addAction(okAction)
    alertController.addAction(cancelAction)
    self.present(alertController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

应用关闭后,用户将手动启动应用。

ios swift

0
推荐指数
2
解决办法
1万
查看次数

标签 统计

ios ×3

swift ×3

arrays ×1

html ×1

javascript ×1

jquery ×1

timer ×1