jQuery UI Widgets Forums Grid save grid data to CSV in backend.

This topic contains 3 replies, has 3 voices, and was last updated by  ivailo 9 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • save grid data to CSV in backend. #73834

    purnima
    Participant

    Hi,
    Here is my grid data

    
    "Order","Id","Comment"
    "1.00","345.00","Do this"
    "2.00","475.00","Dont do this"

    The first column is the column header with order, id and comment. The next two columns are the data.
    The above grid data is collected together and put in a variable named data as shown below:

    var data= \$("#jqxgrid").jqxGrid('exportdata', 'csv');

    Now i am transferring this data via ajax at backend. I need to ensure that data goes through ajax. It does and gives me an alert “Success” when i click on save button. Here is the code for my save button onclick()

    \$(document).ready(function() { \$("#savefile").click(function() {
    
                                    var data= \$("#jqxgrid").jqxGrid('exportdata', 'csv');
                                    console.log(data);
    
                                    \$.ajax({
                                                type: "POST",
                                                url: "http://apmqa.mcm.com/cgi-bin/test/web_editor.pl?action=SavetoCSV",
                                                dataType: "html",
                                                data:data,
                                                success: function (data) {
                                                   alert('Success');
    
                                                },
                                                error: function () {
                                                 alert('Error');
                                                }
                    });
                    console.log(data);
    
                    });
    
    });

    The above code is in perl and thats why you see the \ before every $sign. So i transfer data through ajax.

    This URL below has the function “SavetoCSV”. I need to run this function and ensure that the passed ‘data’ is saved in a CSV file.

    My question is 1) am i doing it right by specifying the location of the function to be called in the url. Is the below statement correct ?

    url: "http://apmqa.mcm.com/cgi-bin/test/web_editor.pl?action=SaveToCSV",
    If yes, the data will go to this method.

    It would be of great help if someone looks into this important issue.

    save grid data to CSV in backend. #73836

    purnima
    Participant

    In short, i want to know is that when we specify the URL, does it mean that the link from where we want the next step to be performed. i.e. it should call SaveToCSV() function which is present in the web_editor.pl

    url: "http://apmqa.mcm.com/cgi-bin/test/web_editor.pl?action=SaveToCSV",

    Does it specify what i want to do with the ajax data. Also when the data is transferred, will i be able to use ‘data’ for manipulation inside SaveToCSV() function. ???

    save grid data to CSV in backend. #73839

    Raj Desai
    Participant

    interesting.. i would like to hear too

    save grid data to CSV in backend. #73853

    ivailo
    Participant

    Hi purnima,

    The way used to send data to the server is right but we don’t have experience with PERL scripts.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.