zoukankan      html  css  js  c++  java
  • EXT.NET循环取GridPanel数据

    前台代码:

    <ext:Button ID="SubmitSelection" runat="server" Text="遍历数据" Icon="PageWhiteEdit"
    ToolTip="遍历数据">
    <DirectEvents>
    <Click OnEvent="SubmitSelection_Click">
    <ExtraParams>
    <ext:Parameter Name="Values" Value="Ext.encode(#{GridPanelMain}.getRowsValues({selectedOnly : true}))"
    Mode="Raw" />
    </ExtraParams>
    </Click>
    </DirectEvents>
    </ext:Button>

    后台代码

    [DirectMethod]
    protected void SubmitSelection_Click(object sender, Ext.Net.DirectEventArgs e)
    {
    string json = e.ExtraParams["Values"];

    if (string.IsNullOrEmpty(json))
    {
    return;
    }
    //<records><record><DictCode>JQFL</DictCode>
    //<DictName>警情分类</DictName>
    //<DictValue>
    // </DictValue>
    //<IsSystem>true
    // </IsSystem><IsShow>true</IsShow><IsUse>true</IsUse><DisplayOrder>37</DisplayOrder><Creator>开发人员
    // </Creator><CreateTime>2012-03-05T13:59:06</CreateTime><Editor /></record>
    //</records>
    XmlNode xml = JSON.DeserializeXmlNode("{records:{record:" + json + "}}");
    foreach (XmlNode row in xml.SelectNodes("records/record"))
    {
    string DictCode = row.SelectSingleNode("DictCode").InnerXml;
    string DictName = row.SelectSingleNode("DictName").InnerXml;
    string DictValue = row.SelectSingleNode("DictValue").InnerXml;
    string CreateTime = row.SelectSingleNode("CreateTime").InnerXml;
    }

    List<sys_Dict> Dicts = JSON.Deserialize<List<sys_Dict>>(json);
    foreach (sys_Dict Dict in Dicts)
    {
    string name = Dict.DictName;
    }


    Dictionary<string, string>[] Dicts1 = JSON.Deserialize<Dictionary<string, string>[]>(json);

    foreach (Dictionary<string, string> row in Dicts1)
    {
    string name = row["DictName"];
    }

    this.ResourceManagerMain.AddScript("Ext.Msg.alert('Submitted', 'Please see source code how to handle submitted data');");
    }

  • 相关阅读:
    tomcat指定运行jdk
    阿里技术面试1
    关于eclipse配置tomcat时,console打印成功消息,但是不能成功访问页面的问题
    websocket需要tomcat8.5.8以上版本才支持
    记一次未解决的异常:java.lang.NoClassDefFoundError: net/sf/json/JSONObject
    曾国藩的修身之道
    @Param的用法和作用
    java集合性能
    springmvc映射html文件以及解决乱码问题
    【redis】--配置
  • 原文地址:https://www.cnblogs.com/leischen/p/2592957.html
Copyright © 2011-2022 走看看