Missing data in FlexGrid

Posted by: zolotoy on 14 September 2017, 11:19 am EST

  • Posted 14 September 2017, 11:19 am EST

    I am showing a hierarchical data in FlexGrid. For some reason some of nodes are not shown. I am attaching an xml file. At least two nodes will not have their children:

    ID=“116” parentID=“104” name=“DEVILLE PRARIE”

    ID=“237” parentID=“1” name=“TRANSMISSION COMPANY”

    Please look into it. This is an urgent matter.

    Thanks

  • Posted 14 September 2017, 11:19 am EST

    Attaching renamed file.

    2015/06/test.txt

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    Could you please share a sample application depicting your issue as it would help us understand what code are you exactly using to convert the xml file into a nested array which can be bound to the itemsSource of FlexGrid, so as to bind and display hierarchy in FlexGrid.

    It would help us to replicate the issue at our end and debug it further.

    Thanks,

    Manpreet Kaur

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    Thank you for the information. However, currently there are no such known issues with the display of large hierarchical dataset in FlexGrid.

    We are working on a sample application that would help us to load the xml provided by you in the UI, hence replicate and debug the issue further. In the meanwhile it would be helpful if you could share a code snippet which lets you convert the xml file into an array that can be bound to FlexGrid to display the hierarchical data.

    We would soon share our observations on the same.

    Thanks,

    Manpreet Kaur

  • Posted 14 September 2017, 11:19 am EST

    My server sends this xml converted into json and then ui parses it into an array. That’s all.

  • Posted 14 September 2017, 11:19 am EST

    Any updates on this?

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    I apologize for the delayed response.

    Kindly refer to the attached HTML Page, which converts the xml file provided by you into a JSON object and later transforms the JSON object to an array, so as to bind it with the FlexGrid to display hierarchical data.

    Hope it helps.

    Thanks,

    Manpreet Kaur

    2015/06/XML_Hierarchy.html

  • Posted 14 September 2017, 11:19 am EST

    I am not sure I am following. Your sample is missing the same data as my code is. What are you showing?

  • Posted 14 September 2017, 11:19 am EST

    That hierarchical xml is sent to UI. In controller I will create $scope.alarmsData = [root.assets];

    html:

    [html]

    </div>
    

    [/html]

    Sorry, but I cannot share my application.

    As I said this is a very urgent matter. I need to know that FG does not have any problem showing a large hierarichal dataset.

    Thanks

  • Posted 14 September 2017, 11:19 am EST

    Also I can see data that is not displayed in debugger. Seems like it’s a pure rendering problem.

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    The sample attached above basically converted the xml provided by you to JSON and later to an array that could be bound to the FlexGrid as a hierarchy data.

    However, we are still able to observe the issue mentioned by you. As mentioned in the other thread(http://wijmo.com/topic/data-structure-for-flexgrid/#post-31337) the node with ID 116 is getting returned as an object and not as an array. This is happening because the node with ID 116 has only one child, hence the xmlToJson method treats it as an object rather than the array. So, it does not displays its children in the FlexGrid.

    You would need to modify the xmlToJson method so as to always return the asset object as an array. We are working on this same code to get this working for this specific scenario.

    We will update you as soon as we find a feasible approach for the same.

    Thanks,

    Manpreet Kaur

  • Posted 14 September 2017, 11:19 am EST

    What I dont understand is how come I am missing the same data when my xml is serialized into json on the server using C# code?

  • Posted 14 September 2017, 11:19 am EST

    Your server code is probably making the same serialzation ‘mistake’. Everyone has continually asked to “see the JSON” and you continue to look past it and focus on the XML. Look at your JSON!

  • Posted 14 September 2017, 11:19 am EST

    My solution is working in the following way:

    Server.

    Data is prepared as an xml. Then it is serialized into json using .net native serializer and returned back.

    Client.

    Gets data and parses it into a Javascript array using JSON.parse.

    As you can see no “my” code involved at all.

    But I will take a look into json. I also looked into an array after parsing the json. It does have all these missing elements.

  • Posted 14 September 2017, 11:19 am EST

    I did not mean to imply that it was necessarily code you personally wrote. Usage of ‘your’/‘my’ in terms of product-specific support generally refers to systems – it is either part of the product-system of which you are requesting support or it is part of ‘your’-system. As you mentioned “my solution is working the following way” – anything that is not part of the product under support is therefore something you introduced and have some level of responsibility for. [Note: I have no affiliation with Wijmo]

    Secondly by ‘mistake’ I didn’t mean there is an actual error/mistake in the code. For XML to JSON, given a single XML doc, it is not possible to determine the meaning/intention of a single nested node – is it a child entity, a property, an array of entities? The only way to correct that ‘mistake’ of misunderstood intention is to use an XML schema along with the serializer (I don’t know if .net supports that) or code a serialzation routine with the intentions built-in.

  • Posted 14 September 2017, 11:19 am EST

    Your point is well taken.

    My assumption was that .net is smart enough to figure it out.

  • Posted 14 September 2017, 11:19 am EST

    The more I look into it the more I think it’s FlexGrid responsibility to handle a such situation. It is a standard json conversion to create an object instead of an array with one element. Was there any expectation to have folders with single folders?

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    Unfortunately, we are no able to find a direct way to resolve the issue that you are currently facing while loading the xml in FlexGrid. We have escalated the issue to the concerned team. We will let you know as soon as we get any information in this regard.

    Thanks,

    Manpreet Kaur

  • Posted 14 September 2017, 11:19 am EST

    Are you saying it is a flexgrid problem? I think it is because it’s not about loading an xml into it. It’s about showing folders with single folders inside.

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    Yes, you are right that the issue is related to the loading of records having single child records as parent records. However, we are not sure if this should be handled by FlexGrid implicitly or the json converted from xml should have the element having a single record as an array.

    So, we have escalated the issue to the concerned team to see if we can get this resolved in the xml json conversion or we need to fix this with FlexGrid.

    Thanks,

    Manpreet Kaur

  • Posted 14 September 2017, 11:19 am EST

    I think it should be handled by the component. Can you give me any idea when that might happen?

    Thanks

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    Currently, we do not have any update regarding this issue. We have requested the concerned team for an update. We will let you know as soon as we get any information in this regard.

    Thanks,

    Manpreet Kaur

  • Posted 14 September 2017, 11:19 am EST

    Any news on that bug?

  • Posted 14 September 2017, 11:19 am EST

    Hello,

    Unfortunately, we do not have any update regarding this issue. We have requested the concerned team for an update. We will let you know as soon as we get any information in this regard.

    We apologize for the inconvenience caused.

    Thanks,

    Manpreet Kaur

  • Posted 14 November 2018, 1:46 am EST

    Hello all.

    Let me start by noting that the FlexGrid displays arrays with flat or hierarchical data.

    It does not parse JSON or XML, but that can be done easily using JavaScript’s JSON object or a DOMParser (or jQuery if you like).

    I looked at the sample and found there was a problem in the parsing code. I wrote another version that is a lot simpler and works OK, it’s attached here.

    XML_Hierarchy_Revised.zip

    This version works on modern browsers (Chrome, Edge, Firefox). It does not work correctly in IE11 because of a poor DOMParser implementation, but I hope the idea is clear enough to be useful.

    I also made a very simple fiddle in case others are interested in the basic ideas we’re discussing:

    https://jsfiddle.net/Wijmo5/xb7rn2sk/

    I hope this information helps.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels