jQuery UI Widgets Forums Grid Extract grid data. output as array or variable ?

Tagged: , , ,

This topic contains 3 replies, has 2 voices, and was last updated by  ivailo 8 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • ashwin prabhu


    I have extracted grid data with this code below:
    var data = \$("#jqxgrid").jqxGrid('exportdata', 'csv');

    If i did a console.log(data); to the above code, i get this as an output.

    "6","12321","3rd test"

    is this data a variable and string ? it doesnot look like an array. 2nd thing- how can i convert this above data into an array.

    ashwin prabhu

    i am able to convert it into an array with this simple code

    var array = data.split(",");

    Please ignore this post guys. Thanks

    ashwin prabhu

    Pardon me, before you let this post go off.. i want one small help…

    "6","12321","3rd test"

    There is a carriage return at the end of 2nd line. plus carriage returns for every row in my grid. How can i replace that carriage return with a comma ?

    i tried using regex but it didnt work. here is the code i tried using.

    data= data.replace(/\r/g,',');

    Instead of replacing carriage return (\r) with a comma (,) – it is giving me an error

    It says:
    Uncaught SyntaxError: Invalid regular expression: missing /


    Hi ashwin prabhu,

    Try data= data.replace(/(?:\r\n|\r|\n)/g, ‘,’);
    Here is the demo.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.