zoukankan      html  css  js  c++  java
  • Coolite GridPanel 操作之一:获取gridpanel 选中行的记录信息

      <Buttons>
                            <ext:Button ID="ButtonSelect" runat="server" Text="Select">
                                <AjaxEvents>
                                    <Click OnEvent="ButtonRoleListSelect_Click">
                                        <ExtraParams>
                                            <ext:Parameter Name="Values" Value="Ext.encode(#{GropRoleList}.getRowsValues())"
                                                Mode="Raw" />
                                        </ExtraParams>
                                    </Click>
                                </AjaxEvents>
                            </ext:Button>
     </Buttons>

    事件:

            public void ButtonRoleListSelect_Click(object sender, AjaxEventArgs e)
            {
                string json = e.ExtraParams["Values"];
                bool addHeader = true;
                DataTable dt = new DataTable();
                StringBuilder sbstr = new StringBuilder();
                Dictionary<string, string>[] companies = JSON.Deserialize<Dictionary<string, string>[]>(json);
                foreach (Dictionary<string, string> row in companies)
                {


                    if (addHeader)
                    {
                        foreach (KeyValuePair<string, string> keyValuePair in row)
                        {
                            dt.Columns.Add(keyValuePair.Key);
                        }
                    }
                    addHeader = false;
                    ArrayList list = new ArrayList();
                    DataRow dr = dt.NewRow();
                    foreach (KeyValuePair<string, string> keyValuePair in row)
                    {

                        dr[keyValuePair.Key] = keyValuePair.Value;
                        if (dr["orgrole_id"] == dr[keyValuePair.Key])
                        {
                            sbstr.Append(keyValuePair.Value + ";");
                        }
                    }
                    dt.Rows.Add(dr);

                }
                if (dt.Rows.Count > 0)
                {
                    try
                    {
                        DC_OperationType operationtype = new DC_OperationType();
                        MSG_OrgRoleOrgMainTainRequest request = new MSG_OrgRoleOrgMainTainRequest();
                        request.orgrole_id = sbstr.ToString();
                        operationtype.DCE_OperationType = DCE_OperationType.Add;
                        request.OperationType = operationtype;
                        request.organization_id = Node_id;
                        client.OrgRoleOrgMaintain(request);

                        string JsFunction = "refreshTree(#{TreePanelOrganization})";
                        //string JsFunction = "alert('dd');";
                        //string JsFunction = "refreshTree()";
                        Coolite.Ext.Web.ScriptManager sm = Coolite.Ext.Web.ScriptManager.GetInstance(HttpContext.Current);
                        sm.AddScript(string.Format("{0};", JsFunction));
                        this.WindowNewRole.Hide();


                    }
                    catch (Exception ex)
                    {
                        Ext.Msg.Alert("错误", "Message: " + ex.Message + ";").Show();
                    }
                }


            }

  • 相关阅读:
    把EXE可执行文件等作为资源包含在Delphi编译文件中
    在DBGrid增加一列CheckBox(而非DBCheckBox)
    TCanvas 类属性及方法
    Windows RPC
    Meteor入门
    IntelliJ IDEA 开发scala
    Web前端开发实用的Chrome插件
    Postman 是一个非常棒的Chrome扩展,提供功能强大的API & HTTP 请求调试
    Ruby入门--Linux/Windows下的安装、代码开发及Rails实战
    IntelliJIDEA Getting+Started+with+Spring+MVC,+Hibernate+and+JSON
  • 原文地址:https://www.cnblogs.com/KingStar/p/1753946.html
Copyright © 2011-2022 走看看