Editor/DataTables pulling back 100% of rows.

Editor/DataTables pulling back 100% of rows.

washuit-iammwashuit-iamm Posts: 121Questions: 51Answers: 2
edited May 1 in Editor

I notice my response contains 100% of rows, theres no information on totals or draws. It does not seem to be respecting the server-side nature.

Also if I do serverSide: true, my table never shows any data. Only when I turn that off and have ajax on, does it work.

Client:

  var table = new DataTable('#InventoryServer', {
      ajax: {
          url: '/api/inventoryservers',
          contentType: 'application/json',
          type: 'POST', // Required because I have so many columns, they wont fit in a query string.
          data: function (d) {
              return JSON.stringify(d);
          }
      },
      serverSide: true,
      processing: true,
      pageLength: 50,
      // .... 

Server:

            var dbType = Environment.GetEnvironmentVariable("DBTYPE");
            var dbConnection = Environment.GetEnvironmentVariable("DBCONNECTION");

            using var db = new Database(dbType, dbConnection, "Microsoft.Data.SqlClient");

            var response = new Editor(db, "InventoryServer", "Id")
                .Model<InventoryServerModel>()
                .Field(new Field("InventoryServer.Id").Set(false)) // Id is DB autogenerated
                .Field(new Field("InventoryServer.Name")
                // TONS more fields... removed for brevity
                .Field(new Field("InventoryServer.DataCenterId")
                    .SetFormatter(Format.IfEmpty(null))
                    .Options(new Options()
                        .Table("DataCenter")
                        .Value("Id")
                        .Label("Name")
                    )
                )
                .MJoin(new MJoin("Product").Set(false)
                    .Link("InventoryServer.Id", "InventoryServerProductLine.InventoryServerId")
                    .Link("Product.Id", "InventoryServerProductLine.ProductId")
                    .Order("Product.Name")
                    .Model<Product>()
                    .Field(new Field("Id")
                        .Options(new Options()
                            .Table("Product")
                            .Value("Id")
                            .Label("Name")
                        )
                    )
                )
               .LeftJoin("DataCenter", "DataCenter.Id", "=", "InventoryServer.DataCenterId")
                .TryCatch(false)
                .Debug(true)
                .Process(Request)
                .Data();

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.