原创

Ext.Net 1.x_Ext.Net.GridPanel RowExpander运用案列

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://david.blog.csdn.net/article/details/7763864

上图:

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];

        };

HTML:

                            <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="330"
                                        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>

CS:

   /// <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 [TaskCode] as 工作流号, dbo.GetStatus(TaskCode) as 状态码,[SerialNo] 报价单,[ClientNo] 客户编码,[ClientDes] 客户简称,");
       strSql.Append("case when [ClientType]='Y' then 'AZ' else 'NAZ' End 客户类型,  "); 
       strSql.Append("[Currency] 币别,[Rate] 汇率,[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();
   }

感谢心是走动的词的无私帮忙,谢谢


 

 

文章最后发布于: 2012-07-19 16:34:32
展开阅读全文
0 个人打赏
私信求帮助

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

©️2019 CSDN 皮肤主题: 鲸 设计师: meimeiellie

分享到微信朋友圈

×

扫一扫,手机浏览