将 span 标签导入 Flexigrid 定义
我有使用 FlexiGrid 定义的表。调用所有变量就可以了。其中一列是我使用 Simple Color Picker JavaScript 选择的颜色。在开始使用 Flexigrid 之前,我将一列定义为:
<span style="background: <c:out value="${current.colore}" />"> </span>
这向我显示了具有所选颜色的小方块。现在我不知道如何使用 FlexiGrid 来做 samo。
我的问题是:如何将 span 标签导入 FlexiGrid 表定义中以读取颜色值并在每一行用该颜色绘制一个框?
表的代码是:
$(document).ready(function() {
$("#newTable").flexigrid({
url: 'agendaTipoAppuntamentoInitJson.do',
dataType: 'json',
colModel : [
{display: 'ID', name : 'idTipoAppuntamento', width : 40, sortable : false, align: 'center', hide: true},
{display: 'Codice', name : 'codice', width : 60, sortable : false, align: 'left'},
{display: 'Descrizione', name : 'descrizione', width : 130, sortable : false, align: 'left'},
{display: 'Descr. breve', name : 'descrBreve', width : 80, sortable : false, align: 'left'},
{display: 'Colore', name : 'colore', width : 80, sortable : false, align: 'left'},
{display: 'ID Struttura', name : 'idStruttura', width : 60, sortable : false, align: 'left', hide: true},
{display: 'Descr. Struttura', name : 'descrizioneStruttura', width : 150, sortable : false, align: 'left'},
{display: 'ID Spec', name : 'idSpecializzazione', width : 60, sortable : false, align: 'left', hide: true},
{display: 'Descr. Spec', name : 'descrizioneSpecializzazione', width : 150, sortable : false, align: 'left'},
],
usepager: true,
title: 'Gestione tipi appuntamento',
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: 950,
height: 370,
singleSelect: true,
click: editMe
}); });
I have table defined with FlexiGrid. Call to all variables is ok. One column is color which I pick with Simple Color Picker JavaScript. Before start to use Flexigrid I was defining one column as:
<span style="background: <c:out value="${current.colore}" />"> </span>
This was showing me small square with choised color. Now I don't know how to do the samo but with FlexiGrid.
My question is: How to import span tag into FlexiGrid table definition to read value for color and to paint me one box with that color at every row?
Code for table is:
$(document).ready(function() {
$("#newTable").flexigrid({
url: 'agendaTipoAppuntamentoInitJson.do',
dataType: 'json',
colModel : [
{display: 'ID', name : 'idTipoAppuntamento', width : 40, sortable : false, align: 'center', hide: true},
{display: 'Codice', name : 'codice', width : 60, sortable : false, align: 'left'},
{display: 'Descrizione', name : 'descrizione', width : 130, sortable : false, align: 'left'},
{display: 'Descr. breve', name : 'descrBreve', width : 80, sortable : false, align: 'left'},
{display: 'Colore', name : 'colore', width : 80, sortable : false, align: 'left'},
{display: 'ID Struttura', name : 'idStruttura', width : 60, sortable : false, align: 'left', hide: true},
{display: 'Descr. Struttura', name : 'descrizioneStruttura', width : 150, sortable : false, align: 'left'},
{display: 'ID Spec', name : 'idSpecializzazione', width : 60, sortable : false, align: 'left', hide: true},
{display: 'Descr. Spec', name : 'descrizioneSpecializzazione', width : 150, sortable : false, align: 'left'},
],
usepager: true,
title: 'Gestione tipi appuntamento',
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: 950,
height: 370,
singleSelect: true,
click: editMe
}); });
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前也经历过和你类似的事情。
在从服务器端发送 Json 数据之前尝试将其放入:
在服务器端 - 在将其发送到 Flexigrid 之前 - 按如下方式创建 Json 数据:
如果它无法正确显示您的跨度,请使用 > >且<而不是 <和>。
I had went through something similar like yours before.
Try before sending your Json data from your-server side to put this:
In your server-side -Before sending it to flexigrid- create your Json data as follow:
In case if it doesn't properly show your span, use > and < instead of < and >.