- Home
- Forum
- ASP.NET Web Forms
- DataTable binding
DataTable binding
How to bind a System.Data.DataTable object (or DataView object) with a PivotGrid control?
Thanks!
Thank you for using Syncfusion products.
We have created a simple sample based on your requirement. Please find the sample in the below link.
Sample Link:
http://www.syncfusion.com/downloads/support/forum/121667/ze/WebApplication441992847766.zip
Please let us know if you have any concerns.
Thanks,
Alagarsamy D.
Can I use this way to bind the OlapClient control?
Thanks!
And How to pass parameters to the relational service?
Thanks!
Please find the below response.
|
S.No |
Query |
Response |
|
1. |
Can I use this way to bind the OlapClient control? |
No, the OlapClient control doesn’t support relational source. Meanwhile the PivotGrid control has the sample facilities like in OlapClient. |
|
2. |
And How to pass parameters to the relational service? |
We have prepared a sample where you can pass the parameters from client side(Scripts) to server side(WCF Service) through “customObject”. Please find the sample and code example in the following links. Sample Link: http://www.syncfusion.com/downloads/support/forum/121667/ze/WebApplication44165547287 Code: [Javascript] <script type="text/javascript"> $(function () { $("#PivotGrid1").ejPivotGrid({ url: "../wcf/RelationalService.svc", title: "OLAP Browser",beforeServiceInvoke: "beforeserviceinvoke", afterServiceInvoke: "afterserviceinvoke" }); });
//This event fires before the service called. function beforeserviceinvoke(args) { if(args.action=="initialize") // You can choose the method in WCF Service to send the parameter. this.model.customObject = "Your Parameter here"; }
//This event fires after the service called. function afterserviceinvoke(args) { this.model.customObject = "Your Parameter here"; } public Dictionary<string, object> InitializeGrid(string action,string customObject) { //The parameter receives in customObject dynamic customData = serializer.Deserialize<dynamic>(customObject.ToString()); ///// |
Regards,
Ramesh G.
It works!
But, I have another question. In my application I have a PivotGrid control and a PivotSchemaDesigner control. Initially I want all the field into the "Choose fields to add to report:" PivotSchemaDesigner section, but all unchecked, ie, Initially the PivotGrid will not have any row field, column field, calculation field... The user will add the fields to the PivotGrid with the PivotSchemaDesigner control. How to do this?
Thanks!
Your requirement can be achievable by binding an empty report under the method “BindDefaultData()”. And we have prepared a sample based on your requirement. Please find the sample in the following link.
Sample Link: http://www.syncfusion.com/downloads/support/forum/121667/ze/WebApplication44-575399247
Regards,
Ramesh G.
It's ok, but this way the "Choose fields to add to report:" PivotSchemaDesigner section shows all fields of the DataView, and I don't want show all of them, and I want to configure the header text of the fields, the numeric format.... How to configure the fields?
Thanks!
Please find the below response.
|
S.No |
Query |
Response |
|
1. |
PivotSchemaDesigner section shows all fields of the DataView, and I don't want show all of them |
We have prepared a sample where you can hide any fields in PivotTable Field List. Please find the sample and code example in the below links. Sample Link: http://www.syncfusion.com/downloads/support/forum/121667/ze/WebApplication44-499798983 Code: [Javascript] function rendersuccess(args) { for (var i = 0; i < $("#schemaFieldTree ul li a").length; i++) {
if( $("#schemaFieldTree ul li a")[i].text == "Your field name here") { $("#schemaFieldTree ul li")[i].remove(); }
} |
|
2. |
I want to configure the header text of the fields, the numeric format.... How to configure the fields? |
The field names in PivotTable Field List must be same as that of in the database. The fields in PivotTable Field List will be used for UI operations like check, uncheck and dragging. On doing so, we need to fetch new values from database, which would be possible if the name in PivotTable Field List and DB matches. This is the our current behavior. |
Regards,
Ramesh G.
And, Can I change the FieldHeader of the fields of the The fields in PivotTable Field List when initialy the PivotReport is empty as the sample?
Thanks!
Hi Jorge,
As mentioned in our previous response, the field names in PivotTable Field List must be same as that of in the database. It is possible to modify the field headers but for further operations like check, uncheck, dragging... it isn’t fetching the correct values from database since the names are taken from PivotTable Field List to match the fields in database.
Regards,
Ramesh G.
- 10 Replies
- 3 Participants
-
JP Jorge Pampin
- Jan 14, 2016 05:36 PM UTC
- Jan 22, 2016 07:24 AM UTC