问题标签 [selectable]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1701 浏览

django - Django-selectable with dynamic inlines

I'm using django-selectable ( https://bitbucket.org/mlavin/django-selectable ) with an admin tabularInline to get autocomplete functionality on one of the inline fields. It works for inlines added at creation time. The problem I'm having is that the autocomplete functionality isn't added when the user adds another row to the inline.

There's a bug and fix for this issue here

https://bitbucket.org/mlavin/django-selectable/issue/12/make-it-work-with-dynamically-added-forms And looking at jquery.dj.selectable.js near the bottom is :

It looks like this should make the autocomplete work with dynamically added rows, but I can't work out what to do for this to work. The admin tabularInline.html has inline_admin_formset so should I be checking for that and not django.jQuery.fn.formset as in the code above ? Or somehow adding inline_admin_formset to django.jQuery.fn ?

Thanks very much for any suggestions.


I'm using version 0.2. In forms.py there is the inline form :

In admin.py the inline admin is made and added to the main admin ( PlanAdmin ) :

After reading your ticket http://code.djangoproject.com/ticket/15760 I tried binding to the inlines formsetadd event, like this

but looking at django/contrib/admin/media/js/inlines.js it seems that these triggers aren't in version 1.3.1 of django. Is it necessary to bind to an event that gets triggered when an inline is added? There is a similar case here https://bitbucket.org/mlavin/django-selectable/issue/31/dynamically-added-forms but that's using the formset plugin. Is there a way to use bindSelectable(row) to the admin inline ?

0 投票
1 回答
916 浏览

jquery - jQuery-UI 可选择输入

请点击此链接:FIDDLE

我正在构建这个输入(这是一个搜索工具)并且我正在输入一些“提示”来选择。

我使用隐藏段落来更好地存储它。

我有两个问题:

  1. 如果您尝试选择 3 个提示并取消选择所有提示,您会看到隐藏文本为空,但输入选择了最后一个提示。
  2. 如果我手动输入“Hello world”并且使用提示,我希望这样,Hello world 总是留在那里,如果我删除所有提示也比。

预先感谢您的帮助。

0 投票
1 回答
181 浏览

jquery - 如何在jQuery UI可选倍数中附加li元素的id

好的,所以我正在尝试集成可选的jQuery UI插件(网格),我喜欢它如何将选定的索引发布回来。这是我想做的事情:

0 投票
1 回答
924 浏览

jquery - 如何将附加数据传递给 ajax post jquery ui selectable grid -> fancybox?

我需要帮助合并两个 jQuery ui 的可选(网格)和花式框(灯箱解决方案)。

现在这个花哨的盒子让一个 ajax 帖子变得非常简单(ahref="link to page")并显示它!问题是 jQuery ui 可选为我抓取数据并将其附加到页面,但我想用 ajax 将其发布到fancybox,以便在我的 php.ini 分析数据后弹出提示。

这是我到目前为止所拥有的

0 投票
1 回答
934 浏览

jquery - ASP.NET MVC:jQuery UI 可选表单发布和验证

我有一个向用户显示的项目列表,并允许他们通过使用 jQuery UI Selectable 交互来选择其中的一个或多个。为了将选定的值发布回控制器,我在每个可选项目中包含一个隐藏的输入字段,我通过选定事件的 javascript 设置。这是我如何设置的示例

模型

html

JavaScript

我的第一个问题,虽然这可行,但它不是最漂亮的解决方案。有没有人有更好的方法来发布可选项目?

其次,我需要确保用户从列表中至少选择了一项。是否可以连接 jQuery 客户端验证以确保用户至少选择了一项?我确实对实现这一点的方法有一些想法,并且创建自定义验证属性没有问题,但我想在我将一些东西放在一起之前,我会问它是否已经完成或最好的方法。

谢谢

0 投票
1 回答
179 浏览

jquery-ui - jQuery UI 可选 - 我做错了什么?

我知道我对 jQuery UI 可选代码做错了,但我不知道到底是什么。另外,如何将 jQuery UI 可选代码的两部分压缩为一个函数?

谢谢!

HTML:

jQuery:

0 投票
1 回答
1584 浏览

jquery - 如何使用php将可选择的jquery存储到mysql db中

我有一个像这样的网格http://jqueryui.com/demos/selectable/#display-grid

如何使用 php 将用户选择的“数字”存储到 mysql db 中?

这是 jquery 可选择的演示 html 代码

0 投票
1 回答
421 浏览

javascript - jQuery 可选事件

我有一个 jQuery 插件,可以将元素拖放到不同的容器中,我想附加一些事件,例如当元素在容器上时。这些事件曾经完美地工作,但后来他们停止工作。由于某种原因,不会触发 Selectable 特定事件,但是当我绑定单击时,例如它可以工作。

例子:

相关代码为:

非常感谢

0 投票
1 回答
1423 浏览

jquery - 如何使用 jquery 基于 xy 坐标选择元素,而不是使用鼠标拖动?

如何根据 XY 坐标选择元素,而不是使用 jquery 进行鼠标拖动? 在此处输入图像描述

0 投票
1 回答
2474 浏览

jquery - 设置元素以选择 jQuery 可选择的 div

我正在构建一个使用 jQuery 和小部件 Selectable 的 Web 应用程序,以让用户在页面上选择多个“文件”(div)。这工作正常,但我想指定,以便他们只能在单击图像时选择一个 div(否则我不能在不取消选择其他链接的情况下使用该链接),我该怎么做?有没有办法使用这个小部件取消选择?

我的 jQuery 代码。

这是我的 HTML 代码:

更新

在这里找到了一个很好的解决方案:Link doesn't work inside UI Selectable