jQuery Tokeninput:readonly无法正常工作 [英] jQuery Tokeninput: readonly not working

查看:94
本文介绍了jQuery Tokeninput:readonly无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 http://loopj.com/jquery-tokeninput/在一个字段中创建一个具有对Web应用程序的管理员访问权限的用户列表。

I'm using the plugin found at http://loopj.com/jquery-tokeninput/ in a field which creates a list of users with admin access to a web application.

搜索,添加和删除用户可以很好地工作。

Searching, adding and removing users works perfectly.

但是,我想使用'readonly'功能阻止人们从列表中删除自己(这会导致问题,因为他们无法看到页面)。

However, I want to use the 'readonly' functionality to stop people removing themselves from the list (which would cause an issue since they wouldn't be able to see the page).

该插件建议将readonly:true 属性添加到设置页面的JSON中。我已经这样做但我仍然可以删除自己。

The plugin suggests adding the "readonly" : true attribute to the JSON which sets the page up. I have done this but I am still able to remove myself.

这是生成的函数。任何人都可以看到它有什么问题吗?

This is the function generated. Can anyone see what's wrong with it?

$("#admin_users").tokenInput("/people/select", {
  prePopulate: [
    {
      "id": 1,
      "name": "Kevin Hughes",
      "readonly": true
    }, {
      "id": 3,
      "name": "Caroline Hughes",
      "readonly": false
    }
  ]
});

正如我所说,除了 readonly 它,它工作正常。

As I say, apart from the readonly bit, it works fine.

额外信息:我也在页面上使用Bootstrap。这可能有任何互动吗?

Extra info: I'm also using Bootstrap on the page. Could this have any interaction?

推荐答案

事实证明,您从 http://loopj.com/jquery-tokeninput/ 实际上并不支持此功能,即使它位于页面上的文档,下载链接显示最新,版本号与其回购中的最新提交相同。

It turns out that the code you get from download link on the web page at http://loopj.com/jquery-tokeninput/ doesn't actually support this feature, even though it's in the documentation on the page, the download link says "latest" and the version number is the same as the latest commit in their repo.

我从他们的GitHub下载了更新的版本 https://github.com/loopj/jquery-tokeninput 现在可以正常使用。

I downloaded a newer version from their GitHub https://github.com/loopj/jquery-tokeninput and it now works fine.

这篇关于jQuery Tokeninput:readonly无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆