question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JS GRID on Dynamic data

See original GitHub issue

HELLO,I HAVE FETCHED THE DATA FROM DATABASE USING JAVA AND STORES IT ON JSON ARRAY .NOW I WANT SHOW THE DATA ON JSGRID TABLE PLEASE HELP ON THIS PROBLEM. THIS IS MY JSGRID CODE

 $("#jsGrid").jsGrid({
    	 height: "70%",
         width: "100%",
         filtering: true,
    editing: true,
    paging: true,
    pageSize: 15,
    pageButtonCount: 5,
       fields: [
    { name: "Patient ID", type: "text", width: 150 },
    { name: "PatientName", type: "text", width: 150 },
    { name: "visitID", type: "text", width: 150 },
    { name: "Contact no", type: "text", width: 200 },
    { type: "kk" }
    ]
    });
    </script>
THIS IS MY BACKEND CODE
			ResultSet rs = st.executeQuery(query);
          

			while (rs.next()) {
				
				  JsonArray row = new JsonArray();
				 row.add(new JsonPrimitive(rs.getString("temp_patient_id")));
	                row.add(new JsonPrimitive(rs.getString("temp_patient_name")));
	                row.add(new JsonPrimitive(rs.getString("temp_gender_id")));
	                row.add(new JsonPrimitive(rs.getString("temp_mobile")));
	                data.add(row);
			}
			jsonResponse.add("ResponseData", data);
                out.println(jsonResponse);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tanhargithubcommented, Apr 1, 2017

Hi Venkatramanaryams,

The data returned by your ajax call should either be in this format:

[{“Author”:“Gambardella, Matthew”,“Description”:“An in-depth look at creating applications with XML.”,“Genre”:“Computer”,“ID”:“bk101”,“PlotNo”:“101”,“Price”:44.95,“Title”:“XML Developer’s Guide”},{“Author”:“Ralls, Kim”,“Description”:“A former architect battles corporate zombies,\u000a an evil sorceress, and her own childhood to become queen\u000a of the world.”,“Genre”:“Fantasy”,“ID”:“bk102”,“PlotNo”:“102”,“Price”:5.95,“Title”:“Midnight Rain”}]

If there are any changes in the structure of the data returned by your ajax call, you can form it as object array as shown above on success of the ajax call.

1reaction
richraid21commented, Mar 28, 2017

Per the documentation, you need to provide a data property or controller object to JSGrid

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic data import - Grid.js
Dynamic data import. The data attribute accepts a function as well: Live Editor. const grid = new Grid({ columns: ['Name', 'Email', ...
Read more >
How to Convert a Static HTML Table to a Dynamic JavaScript ...
Load a list of Todo Items from a REST API and render in the table. Convert the HTML Table to a Data Grid...
Read more >
JavaScript Dynamic Grid Lesson 4 Free Online Course ...
Dynamic JavaScript WebPages DOM CSSGrid Create Page ElementsGet the Course Free https://www.udemy.com/course/ javascript - grid /Course content ...
Read more >
Create dynamic grid (row and col) for data coming from API call
I am completely new to React JS and JavaScript ...
Read more >
Data grid with dynamic data - CodePen
A data grid connected to a dynamic remote endpoint, made with ZingGrid javascript library....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found