Pivot data binding

Hi, I'm using .NET MVC as middle tier and I'm trying to call a action and returning Json data , to bind Pivot. But i'm not able to bind the data using $$('pivot').load()



  • Hello @anirudh_k,

    While we do not have actual demos for ASP.NET MVC, you should have no issues with data loading as long as you return a JSON dataset from your backend, as far as I can see. Webix components are fully client-side, so they do not require any special code on the server side. The only requirement is that you have to follow the correct request/response formats. The basic description of the loading and saving patterns is described in the related docs chapter (note the "Data loading/saving" chapter).

    Could you please describe your issue in a bit more detail? Going by your description, I am assuming that you are getting the server response on the client-side but do not see any data inside the pivot table, is that correct? Please make sure that you have the correct structure set inside the component (this is necessary to display the incoming data) and that you are indeed receiving the server response on the client (you can check the Network tab in your browser to see if the requested URL ends up getting a response at all). If you do get a response on the client, make sure it returns the correct data.

    Here is what is should look like with the correct component configuration/correct server response format - https://snippet.webix.com/q0x8ik6r.

  • I'm returning data in this format ""[{ \"Customer\": \"Customer1\", \"Amount\": \"1000\"}]"" from controller as jsonresult. But in Pivot i still don't see any data. And in configure menu, inside fields section it show values. which shows complete json result as single value.

  • edited June 9

    I'm returning data in this format ""[{ \"Customer\": \"Customer1\", \"Amount\": \"1000\"}]"" from controller as jsonresult.

    Does the incoming data have double quotes on both sides or just a single set of quotes? Assuming the dataset has a single set of quotes, the following format should be accepted just fine, provided that you have configured your pivot component correctly.

    Please take a look at the following example: https://snippet.webix.com/viiayby1.

    As you can see, the following format is accepted and is being processed just fine.

    In the case that you do receive a dataset with two sets of quotes, or any other dataset with an incorrect format, you can process the result on the client-side and convert it to the correct format this way. There are a few ways you can do this:

    - Issue a separate request to the server via webix.ajax().get() method - as a result, a promise will be returned. You can use the resolved promise data and parse it directly into the pivot component.

    Here is an example using a separate promise, following the same principle as described above: https://snippet.webix.com/y2mu14by.

    - Change the way the data is being processed inside the component by creating a custom Data Driver: https://snippet.webix.com/yvkf17fp.

    Alternatively, you can simply provide the data in the correct format (i.e. change the way you get your data from the server-side):

    [{ "Customer": "Customer1", "Amount": "1000"}]

    If you were to configure the pivot component properly, you would get the following result: https://snippet.webix.com/o9xvangz.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion