0

I have to do columns in syncfusion grid should dynamically create with all its parameters using syncfusion grid by passing json data contains all information about to form grid

 <div id="Grid" ej-grid e-datasource="data">

in above code all information to form a grid passing through $scope.data = dataforgrid;

1 Answers1

1

Please refer the following online link for defining columns with alignment, width and format properties for Syncfusion Grid using angularjs.

Online Link: Sample

For dynamically changing the columns along with it's properties as per the given json data source, define the following code snippets in your controller method.

//...

var newColumns = [
                        { field: "OrderID", headerText: "Order ID", width: 75 , textAlign: ej.TextAlign.Right },
                        { field: "CustomerID", headerText: "Customer ID", width: 80 },
                        { field: "EmployeeID", headerText: "Employee ID", width: 75, textAlign: ej.TextAlign.Right },
                        { field: "Freight", width: 75, format: "{0:C}", textAlign: ej.TextAlign.Right },
                        { field: "OrderDate", headerText: "Order Date", width: 80, format: "{0:MM/dd/yyyy}", textAlign: ej.TextAlign.Right },
                        { field: "ShipCity", headerText: "Ship City", width: 110 }
                ];



//...

$scope.columns = newColumns;

//...
John R
  • 2,741
  • 2
  • 13
  • 32
  • i have used that link to form grid using angularjs but there they given fixed no of columns. i dont have to declare column i have to decide based on json data passed to gird – Gomtesh Hatgine Jun 09 '15 at 04:29