[Ext.Net] 1.x_Ext.Net.Grid之行展开

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/david_520042/article/details/7904317
<Plugins>
                    <ext:RowExpander ID="RowExpander" runat="server">
                        <DirectEvents>
                            <BeforeExpand OnEvent="BeforeExpand" Success="setSubprojectExpandInfomation(response, result, el, type, action, extraParams);"
                                Before="return !record.cached;">
                                <EventMask ShowMask="true" MinDelay="500" Target="CustomTarget" CustomTarget="={GPCooper.body}" />
                                <ExtraParams>
                                    <ext:Parameter Name="ProjectID" Value="record.data['id']" Mode="Raw" />
                                </ExtraParams>
                            </BeforeExpand>
                        </DirectEvents>
                        <Component>
                            <ext:FormPanel ID="RowEditor1" runat="server" Padding="6" Height="260" Border="false"
                                Layout="ColumnLayout" AnchorHorizontal="100%" AutoScroll="true">
                                <Items>
                                    <ext:Panel ID="panDetail" runat="server" Header="true" Border="false" FormGroup="true"
                                        Title="项目信息" ColumnWidth="1.0">
                                    </ext:Panel>
                                </Items>
                            </ext:FormPanel>
                        </Component>
                        <Listeners>
                            <Expand Handler="#{RowEditor1}.record = record; #{RowEditor1}.getForm().loadRecord(record);" />
                        </Listeners>
                    </ext:RowExpander>
                </Plugins>

JS

        //展开子项目
        var setSubprojectExpandInfomation = function (response, result, expander, type, action, params) {
            var prj = Ext.getCmp("panDetail");
            var values = result.extraParamsResponse.content;
            var value = values.split('|'); //多个值分割符号
            prj.body.dom.innerHTML = value[0];

        };

后台:

   /// <summary>
   /// 子项目展开
   /// </summary>
   /// <param name="sender"></param>
   /// <param name="e"></param>
   protected void BeforeExpand(object sender, DirectEventArgs e)
   {
       string projID = e.ExtraParams["ProjectID"];


       DataTable dt = new DataTable();
       StringBuilder strSql = new StringBuilder();
       strSql.Append("SELECT ZMQuotation.id,[TaskCode] as 工作流号, dbo.GetStatus(TaskCode) as 状态码,[SerialNo] 报价单,");
       strSql.Append("[ProductType] 财务模版,[ProductType2] 产品类型, "); 
       strSql.Append("[Customer P/N] 客户品号,[Internal P/N] 内部品号,[Date] 创建日期,us.name as 工程师,users.name as 业务员,rtrim([dbo].[GetTaskMark](TaskCode)) as 进度,  ");
       strSql.Append("SaleRemark 销售备注,RdRemark 开发备注,PurRemark 采购备注,FinRemark 财务备注 "); 
       strSql.Append("FROM [OA].[dbo].[ZMQuotation] left join users on [BusinessId]=users.id  "); 
       strSql.Append("left join users as us on [EngineerId]=us.id ");
       strSql.Append("where [ZMQuotation].id= " + projID);

       dt = SqlHelper.ExecuteDataset(SqlHelper.conn, CommandType.Text, strSql.ToString()).Tables[0];

                    
       StringBuilder html = new StringBuilder();
       html.Append("<table class=\"data\">");
       for (int i = 0; i < dt.Rows.Count; i++)
       {
           for (int j=0; j < dt.Columns.Count; j++)
           {
               html.Append("<tr>");
               html.Append("<td width='100px' align=right><B>" + dt.Columns[j].ColumnName + ":</B>" + "</td>");
               html.Append("<td>" + dt.Rows[i][j] + "</td>");
               html.Append("</tr>");
           }
       }

       html.Append("</table>");
       e.ExtraParamsResponse["content"] = html.ToString();
   }

上图:感谢心动的词提供支持




展开阅读全文

没有更多推荐了,返回首页