jQuery UI Widgets Forums Grid Export JSON to CSV

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 11 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Export JSON to CSV #30807

    stvhui
    Participant

    Hello to you,

    I’m newbie in javascript and php world

    I’m in learning to using JQWidgets

    I knows the commercial version have variety types to export data

    Would you mind to showing, How to export JSON to CSV by using guidance from http://www.danmandle.com/blog/json-to-csv-conversion-utility

    and please download it code at https://github.com/danmandle/JSON2CSV

    Please show me by an example as retrieving table into grid, and have export button to export into CSV.

    Thanks in advance

    Regards,
    Steven

    Export JSON to CSV #30809

    Dimitar
    Participant

    Hello Steven,

    We support only jQWidgets and not third-party software. Surely, you may find a tutorial on the matter if you make an Internet search.

    And here are the examples you requested:

    1) Load a grid from table;
    2) Export a grid to CSV and other file formats.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Export JSON to CSV #30812

    stvhui
    Participant

    Hello Dimitar,

    Thanks for yr reply

    data.php

    ...
    // SELECT COMMAND
    $result = mysql_query($query) or die("SQL Error 1: " . mysql_error());
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $tblmember[] = array(
    'memberno' => $row['memberno'],
    'relationno' => $row['relationno'],
    'membername' => $row['membername'],
    'dob' => $row['dob'],
    'dob_tgl' => $row['dob_tgl'],
    'dob_bln' => $row['dob_bln'],
    'dob_thn' => $row['dob_thn'],
    'chinesename' => $row['chinesename'],
    'bloodid' => $row['bloodid'],
    'address' => $row['address']
    );
    }
    echo json_encode($tblmember);

    default.php

    ...
    $("#excelExport").jqxButton({ theme: theme });
    $("#excelExport").click(function () {
    });

    My questions is :
    1. Is $tblmember is JSON formatted or json_encode($tblmember) is JSON formatted? which one is right
    If the answer is json_encode($tblmember)

    2. can I put code in excelExport block as :

                $("#excelExport").click(function () {
    require_once('json2csv.class.php');
    $JSON2CSV = new JSON2CSVutil;
    $JSON2CSV->readJSON(json_encode($tblmember));
    $JSON2CSV->browserDL("JSON2.CSV");
    });

    What’s wrong with above code? especially in parameter passing to readJSON function

    	function readJSON($JSONdata){
    $this->dataArray = json_decode($JSONdata,1);
    $this->prependColumnNames();
    return $this->dataArray;
    }

    Please guide & advice.

    Regards,
    Steven

    Export JSON to CSV #30821

    Dimitar
    Participant

    Hi Steven,

    These questions are not related to jQWidgets. We do not have any experience with JSON2CSV and cannot be of assistance on the matter.

    Best Regards,
    Dimitar

    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.