[CLOSED] GridPanel with Remote Filtering, Sorting and Paging (datatable)

  1. #1

    [CLOSED] GridPanel with Remote Filtering, Sorting and Paging (datatable)

    Hi,

    Trying to use this example (https://examples1.ext.net/#/GridPane...ilters_Remote/). But instead of the fixed list in the example I trying to use datatables.


    I've tried this:


    
    
    public List<object> DataTableToList(ref DataTable dt)
      {
          List<object> list = new List<object>(); 
          foreach (System.Data.DataRow row in dt.Rows) 
          { 
              Dictionary<string, object> rowDic = new Dictionary<string, object>();
              foreach (System.Data.DataColumn column in row.Table.Columns) 
              { 
                  rowDic.Add(column.ColumnName, row[column]);
              } 
              list.Add(rowDic); 
          }
          return list; 
       }

    As a substitute for this:


    
    
    public static List<object> Data
        {
            get
            {
                var goods = new List<object>
                                {
                                    new
                                        {
                                            Id = 1,
                                            Price = 71.72,
                                            Company = "3m Co",
                                            Date = new DateTime(2007, 9, 1),
                                            Size = "large",
                                            Visible = true
                                        },
                                    ...
                                };
    
    
                return goods;
            }
        }




    But that's not working.


    SO..how do can I convert a simple datatable to a list I can use with your code.


    Regards,


    Martin
  2. #2

    RE: [CLOSED] GridPanel with Remote Filtering, Sorting and Paging (datatable)

    Hi,

    Converting is not required. Store can work with dataset/datatable
    Please provide test sample which demonstrates how all configured
  3. #3

    RE: [CLOSED] GridPanel with Remote Filtering, Sorting and Paging (datatable)

    I know a store can work with datatable, but I love the quite easy way of remote pagina/sorting/filtering of a list in your example.

    I'm using datatables with 1 to 10K rows and local paging/filtering/sorting is to heavy (tried it..but isn't workable)


    Can't figure out how to use remote paging/sorting/filtering with a datatable (probably due to my inexperiece with c#)


    this:


    
    
    public List<object> DataTableToList(ref DataTable dt)
        {
            List<object> list = new List<object>(); 
            foreach (System.Data.DataRow row in dt.Rows) 
            { 
                //foreach (System.Data.DataColumn column in row.Table.Columns) 
                //{
                    object x = new
                    {
                        brandstofContractNummer = Convert.ToInt32(row["brandstofContractNummer"]),
                        Kenteken = Convert.ToString(row["Kenteken"]),
                        pasNummer = Convert.ToString(row["pasNummer"])
                                        };
                //} 
    
    
                    list.Add(x);
            }
            return list; 
          }

    ...does the job, but I don't want to define the specific columns. I want them to be extracted from the provided datatable. (so I want to create one specific grid to be used for several datatables with different columnsets). I already succeed in creating the filters, store and grid from a datatable, but without remote features.


    Martin




  4. #4

    RE: [CLOSED] GridPanel with Remote Filtering, Sorting and Paging (datatable)

    Hi,

    I am not sure what issues do you have. We need full page sample which demonstrates how all configured. You can send your zipped project to the support email and we review it privately.


    Did you see remote paging/sorting exampes in the Examples Explorer?
    https://examples1.ext.net/#/GridPane..._Sorting/Page/




    Also please see the following sample which demonstrates how to change fields and column during ajax request
    http://forums.ext.net/showthread.php?postid=33458.aspx
  5. #5

    Try this

    public static List<tblOrder> Data()
    {

    DataClasses1DataContext obj = new DataClasses1DataContext();


    return obj.tblOrders.ToList();

    }
  6. #6

    use linq to sql datasource.......

    use linqtsql datasource

Similar Threads

  1. Replies: 6
    Last Post: Nov 03, 2012, 10:48 PM
  2. Replies: 11
    Last Post: Jun 13, 2012, 4:53 PM
  3. Replies: 0
    Last Post: Jul 07, 2011, 8:19 PM
  4. Replies: 0
    Last Post: Aug 16, 2010, 10:28 PM
  5. Replies: 2
    Last Post: Nov 17, 2009, 1:26 PM

Posting Permissions