Creating a multidimensional object for XML export

后端 未结 2 1922
庸人自扰
庸人自扰 2021-01-29 10:44

I am importing a csv file which has a lot of invoice data. This data needs to be grouped together based on Vendor ID to display a heading for each Vendor with a sum of all invo

2条回答
  •  一向
    一向 (楼主)
    2021-01-29 11:06

    Some thoughts:

    • $.each(data, ... //looping once to display header info such as sum You're not creating a sum anywhere. Also, this is the one and only loop that iterates over all data rows.
    • XMLObject = []; // Creating a new object for each row - No, you're creating an Array. You really should create an Object ({}), because you use it as an object.
    • XMLObject =.... You're lacking a var keyword here. You create a new object each iteration, but assign every of them to the same global variable. This is the reason the the #Payment_Format change handler will only change the format of the last created object - the one currently referenced by "XMLObject".
    • $('...
    提交评论

提交回复
热议问题