Forum Stats

  • 3,872,125 Users
  • 2,266,392 Discussions
  • 7,911,052 Comments

Discussions

Load Json into interactive grid via js

Frankk
Frankk Member Posts: 2
edited Jun 10, 2019 2:49PM in APEX Discussions

Hi, i want to load json /array into interactive grid via js.

For grid i see that u can do something like the code below but i want use the interactive grid component for allow users search/order/inline edition.

https://docs.oracle.com/en/database/oracle/application-express/19.1/aexjs/grid.html

var fieldDefinitions = {

    id: {

        index: 0,

        heading: "Id",

        seq: "1"

    },

    name: {

        index: 1,

        heading: "Name",

        seq: "2"

    }

};

var data = [

    ["1022", "Betty"],

    ["1023", "James"],

    ...

];

apex.model.create( "myModel", {

    recordIsArray: true,

    fields: fieldDefinitions

}, data );

$( "#myGrid" ).grid( {

    modelName: "myModel",

    columns: [  fieldDefinitions ]

} );

Tagged:

Answers

  • John Snyders-Oracle
    John Snyders-Oracle Member Posts: 1,436 Employee
    edited Jun 10, 2019 2:49PM

    Hi,

    Please provide the APEX version and more details about what you are trying to accomplish. Specifically why this isn't treated as a data upload case where you select a file for data load?

    Regards,
    -John

  • I would also like to know if this is possible, specifically to use JavaScript to grab data from a rest source and plug it into an interactive grid. I know this is possible with an Apex rest source but I don’t know how to recursively call a rest source to build my dataset, and it is much easier to accomplish in JavaScript.

  • User_TA0GK
    User_TA0GK Member Posts: 1 Red Ribbon

    I have a similar request for APEX 20.2 wanting to load a JSON data object into an Interactive Grid, i am getting this data from a web service using apex_web_service.make_rest_request but i have to set headers for this web service so I am doing it in PL/SQL that returns the JSON data as a CLOB.