将 span 标签导入 Flexigrid 定义

发布于 2025-01-01 09:18:03 字数 1817 浏览 1 评论 0原文

我有使用 FlexiGrid 定义的表。调用所有变量就可以了。其中一列是我使用 Simple Color Picker JavaScript 选择的颜色。在开始使用 Flexigrid 之前,我将一列定义为:

<span style="background: <c:out value="${current.colore}" />">&nbsp;&nbsp;&nbsp;</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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清欢 2025-01-08 09:18:03

我以前也经历过和你类似的事情。
在从服务器端发送 Json 数据之前尝试将其放入:

在服务器端 - 在将其发送到 Flexigrid 之前 - 按如下方式创建 Json 数据:

total: (no of rec)
 page : (page no)
 rows : [{cell: [ (col1 value) , <span style="background: <c:out value=" + MyColorValue1 + " />">   </span> ,.. ] },
        {cell: [ (col1 value) , <span style="background: <c:out value=" + MyColorValue2 + " />">   </span>  ,.. ] }]

如果它无法正确显示您的跨度,请使用 > >且<而不是 <和>。

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:

total: (no of rec)
 page : (page no)
 rows : [{cell: [ (col1 value) , <span style="background: <c:out value=" + MyColorValue1 + " />">   </span> ,.. ] },
        {cell: [ (col1 value) , <span style="background: <c:out value=" + MyColorValue2 + " />">   </span>  ,.. ] }]

In case if it doesn't properly show your span, use > and < instead of < and >.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文