作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在使用g select标签编写的grails应用程序中有6个下拉列表,现在我需要在所有下拉列表中进行多个选择,但是我无法使用Grails multi select plugin 来实现
首先,我在Buildconfig.groovy中使用以下几行包含了插件-multiselect和资源:
compile ":multi-select:0.2"
runtime ":resources:1.2.2"
<g:select from="['AFFILIATES', 'CSE','DISPLAYADS','EMAIL','MOBILEWEB','OTHERS','ORGANIC','SEO', 'SEM']" name="mv" id = "mv"
onchange="${remoteFunction(
controller:'Com',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'mv=\'+this.value+\'&department=\'+$(\'department\').value+\'&device=\'+$(\'device\').value+\'&browser=\'+$(\'browser\').value+\'&platform=\'+$(\'platform\').value+\'&time_period=\'+$(\'time_period\').value+\'&metric=\'+$(\'metric\').value',
onSuccess: 'printpgtyp(data)')}"
></g:select>
<ui:multiSelect from="['AFFILIATES', 'CSE','DISPLAYADS','EMAIL','MOBILEWEB','OTHERS','ORGANIC','SEO', 'SEM']" multiple="yes" name="mv" id = "mv" noSelection="['':'Select One']"
onchange="${remoteFunction(
controller:'Com',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'mv=\'+this.value+\'&department=\'+$(\'department\').value+\'&device=\'+$(\'device\').value+\'&browser=\'+$(\'browser\').value+\'&platform=\'+$(\'platform\').value+\'&time_period=\'+$(\'time_period\').value+\'&metric=\'+$(\'metric\').value',
onSuccess: 'printpgtyp(data)')}"
/>
<ui:resources includeJQuery="true"/>
<g:select from="['AFFILIATES', 'CSE','DISPLAYADS','EMAIL','MOBILEWEB','OTHERS','ORGANIC','SEO', 'SEM']" name="mv" id = "mv" multiple="true"
onchange="${remoteFunction(
controller:'Com',
action:'ajaxGetMv',
// params:'\'mv=\' + escape(this.value)',
params:'\'mv=\'+this.value+\'&department=\'+$(\'department\').value+\'&device=\'+$(\'device\').value+\'&browser=\'+$(\'browser\').value+\'&platform=\'+$(\'platform\').value+\'&time_period=\'+$(\'time_period\').value+\'&metric=\'+$(\'metric\').value',
onSuccess: 'printpgtyp(data)')}"
></g:select>
def ajaxGetMv = {
if(params.metric == 'Marketing visits')
{
def com = Com.executeQuery("select p.date_hour, p.visits, case when visits_ly IN (0,null) THEN 0 ELSE ((visits/visits_ly - 1)*100) END as yoy, case when visits_lw IN (0,null) THEN 0 ELSE ((visits/visits_lw - 1)*100) END as wow, p.mv, p.browser, p.department, p.platform, p.device, p.time_period from Com p where p.department = ? and p.device = ? and p.browser = ? and p.platform = ? and p.mv = ? and p.time_period = ? order by col_0_0_ asc ",[params.department, params.device, params.browser, params.platform, params.mv, params.time_period])
render com as JSON
}
//.........else if and so on for all my metrics
最佳答案
Grails 2.x支持无插件的多重选择。以下是文档中的示例。多选用户界面不是最好的。
// create multiple select
<g:select name="cars"
from="${Car.list()}"
value="${person?.cars*.id}"
optionKey="id"
multiple="true" />
<g:each in="${Car.findAllByActive(true)}" var="car">
<div class="span4 checkbox">
<g:checkBox name="cars" value="${car.id}" checked="${car in instance?.cars}" />
<label>${car.name}</label>
</div>
</g:each>
params.cars.each { it ->
instance.cars.add(Car.findById(it as Long))
}
关于grails - Grails多选插件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24914873/
我正在尝试用 Swift 编写这段 JavaScript 代码:k_combinations 到目前为止,我在 Swift 中有这个: import Foundation import Cocoa e
我是一名优秀的程序员,十分优秀!