gpt4 book ai didi

c# - DHTMLX 网格 : Populate cells with dropdown menu

转载 作者:太空宇宙 更新时间:2023-11-04 15:14:30 26 4
gpt4 key购买 nike

我在 dhtmlx 网格表 中有 2 列。我想用每个单元格的 dropdown menu 填充第二列。

我正在用 C# 生成 xml 文档

C#生成的xml文件:

<rows>

<head>
<column type="ed" width="205" sort="str">Product</column>
<column type="co" width="205" sort="na" id="last">Class</column>
</head>

<row id="1">
<cell>Product_name_1</cell>
<cell>
<select>
<option id="1" value="1">first_option</option>
<option id="2" value="2">second_option</option>
</select>
</cell>
</row>

<row id="2">
<cell>Product_name_2</cell>
<cell>
<select>
<option id="3" value="4">first_option</option>
<option id="4" value="4">second_option</option>
</select>
</cell>
</row>

</rows>

HtmlJavascript 代码:

<body>
<div id="mygrid_container" style="width:1026px;height:500px"></div>
<script>
var mygrid;
$(document).ready(function () {
$.ajax({
url: "/Admin/XMLForProducts",
dataType: "json",
type: "GET",
data: {},
success: function (result) {
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.init();
mygrid.parse(result, "xml");
}
});
});
</script>
</body>

在这种情况下,我只是让第一列填充了值(Product_name_1Product_name_2),我没有让第二列的每个单元格都有下拉菜单我不知道如何解决这个问题..

最佳答案

  1. 您需要使用某种转义 xml 中的空格字符的方法。例如,

代替:

    <cell>
<select>
<option id="3" value="4">first_option</option>
<option id="4" value="4">second_option</option>
</select>
</cell>

你需要:

<cell><![CDATA[<select><option id="3" value="4">first_option</option><option id="4" value="4">second_option</option></select>]]></cell>

这是关于处理 xml 中特殊字符的教程: http://docs.dhtmlx.com/doku.php?id=others:special_characters_in_xml

  1. 此外,我们不建议在您的网格中以这种方式使用 html 输入。您可以尝试使用“组合”exCell。

在这里你可以找到一个现成的例子:

http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/13_interaction_other_components/01_pro_combo.html

和教程:http://docs.dhtmlx.com/doku.php?id=dhtmlxgrid:how_to_use_new_excell_combo

关于c# - DHTMLX 网格 : Populate cells with dropdown menu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16871935/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com