ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DevExpress ASPxGridView 使用文档七:客户端API

DevExpress ASPxGridView 使用文档七:客户端API

原创 Linux操作系统 作者:fangqm 时间:2010-12-17 15:14:28 0 删除 编辑
DevExpress ASPxGridView 使用文档七:客户端API
转载请注明出处:http://surfsky.cnblogs.com/
 
---------------------------------------------------------
-- ASPxGridView 客户端API
---------------------------------------------------------
API
    PerformCallback(this.value);
    CollapseAll()
    ExpandAll()
    SelectRows()
    UnselectRows()
    UnselectAllRowsOnPage()
    SelectAllRowsOnPage(this.checked)
 

---------------------------------------------------------
示例
---------------------------------------------------------
客户端事件按钮控制 grid 放缩
   
   
   
       
   
 

下拉框触发grid的ajax刷新
   
    protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        int layoutIndex = -1;
        if(int.TryParse(e.Parameters, out layoutIndex))
            ApplyLayout(layoutIndex);
    }
   
用定时器出发grid的ajax刷新
    
        
    

   
     protected void grid_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
     {
         grid.DataBind();
     }
 
---------------------------------------------
-- GridView 客户端选择行
---------------------------------------------
行聚焦(FocusedRowChanged)
    注:必须定义行主键:gv.KeyFieldName = "UserId";
    // 聚焦行变更事件。向服务器查询聚焦行的 "EmployeeID" 和 "Notes" 信息,并该信息将返回到 OnGetRowValues() 函数
    function OnGridFocusedRowChanged() {
        grid.GetRowValues(grid.GetFocusedRowIndex(), "EmployeeID;Notes", OnGetRowValues);
    }
    // 处理服务器端传回的数据(values是个数组,包含 "EmployeeID" 和 "Notes" 值)
    function OnGetRowValues(values) {
        DetailImage.SetImageUrl("FocusedRow.aspx?Photo=" + values[0]);
        DetailNotes.SetText(values[1]);
    }
            PreviewFieldName="Notes" AutoGenerateColumns="False" EnableRowsCache="false" Width="100%">
       
           
           
           
           
           
       
        
       
       
       
   

   

详细信息:


   
   
   
 
用control键+点击行可多选
    
 
全选、全部反选
    
        
        
           
                
                    
                

                
           

           
           
           
           
                    
        

    
 

客户端选择多行
   
   


      选择的记录条数:
      0           
   

               
   
     
       
                               
                               
                               
                               
                            
     
                   
     
   

    ----------------------------------------
    function grid_SelectionChanged(s, e) {
        s.GetSelectedFieldValues("ContactName", GetSelectedFieldValuesCallback);
    }
    function GetSelectedFieldValuesCallback(values) {   
        selList.BeginUpdate();
        try {
            selList.ClearItems();
            for(var i = 0; i < values.length; i ++) {
                selList.AddItem(values[i]);
            }
        } finally {
            selList.EndUpdate();
        }
        document.getElementById("selCount").innerHTML = grid.GetSelectedRowCount();
    }
 

客户端选择行
   
    //function is called on changing focused row
    function OnGridFocusedRowChanged()
    {
        // Query the server for the "EmployeeID" and "Notes" fields from the focused row
        // The values will be returned to the OnGetRowValues() function
        grid.GetRowValues(grid.GetFocusedRowIndex(), "EmployeeID;Notes", OnGetRowValues);
    }
    //Value array contains "EmployeeID" and "Notes" field values returned from the server
    function OnGetRowValues(values)
    {
        var notes = document.getElementById("detailnotes");
        notes.value = values[1];
        var image = document.getElementById("detailimage");
        image.src = "FocusedRow.aspx?Photo=" + values[0];
    }
   
 
   
       
           
           
           
           
           
       

       
       
       
   

   
       
           
           
       
   
Image

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23109131/viewspace-682046/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
创业项目 https://u.rscode.cn

注册时间:2010-03-24

  • 博文量
    297
  • 访问量
    784625