Comments (12)
If you loading data by pages from server (pageLoading: true
), then you should return data in format
{
data: [items],
itemsCount: amountOfItems
}
// for your case
{
data: [{"AccountName":"MyAccount","ContactNumber":"111-111-7890","AccountNumber":"123456789","UserName":"JaneDoe"}],
itemsCount: 1 // without array
}
In most cases it's enough to load all data (usually it works faster for not huge amount of data). In this case just return the array of items.
See following fiddle with two examples http://jsfiddle.net/tabalinas/6690vqaz/
from jsgrid.
Thanks for the reply. I tried your suggestion, however it just keeps showing the please wait. When looking in the browser console I see the following error. I am also doing a console.logo on my promise data to see that it is formatted correctly. Any suggestions on how to resolve this?
{ data: [{"AccountName":"MySuperDuperAccount","ContactNumber":"123-456-7890","AccountNumber":"123456789","UserName":"RickyBobby","Password":"FightingChicken","DueDate":"2015-05-20","MonthlyPayment":"100.00"}], itemsCount: 1 }
jsgrid.core.js:492 TypeError: undefined is not an object (evaluating 'this.data.length')
from jsgrid.
what I am trying to do is an asynchronous call and returning the data in a promise.
from jsgrid.
Please, provide entire grid config. Maybe you could modify my fiddle to demonstrate the problem.
from jsgrid.
I have updated your fiddle. However, you will not see the error due to the DB not existing, but you are able to see the controller code that I am using. Perhaps I am doing something incorrectly there?
Thanks,
John
On May 29, 2015, at 12:56 AM, Artem Tabalin [email protected] wrote:
Please, provide entire grid config. Maybe you could modify my fiddle to demonstrate the problem.
—
Reply to this email directly or view it on GitHub #35 (comment).
from jsgrid.
Send me the link to the updated fiddle then.
from jsgrid.
Here is the link:
http://jsfiddle.net/6690vqaz/1/
On May 29, 2015, at 1:20 PM, Artem Tabalin [email protected] wrote:
Send me the link to the updated fiddle than
—
Reply to this email directly or view it on GitHub #35 (comment).
from jsgrid.
The promise should be resolved an actual JS object, not a string representation
feeds = '{ data: ['+feeds+'], itemsCount: '+len+' }';
def.resolve(feeds); // feeds is a string, but should be an object
Should be
feeds = {
data: [items] // provide array, not a string here too
itemsCount: len
};
def.resolve(feeds);
Hope it will help.
from jsgrid.
That is very helpful. I am now getting the screen to come up, however the cells are blank. When looking in the browser console I do the javascript object. can you tell if I am loading the object incorrectly? I am putting the array in, but perhaps the format is incorrect?
[Log] Object (roa.js, line 57)
data: Array[1]
0: "{"AccountName":"MySuperDuperAccount","ContactNumber":"123-456-7890"}"
length: 1
proto: Array[0]
itemsCount: 1
proto: Object
Here is the code that I used to create the object:
function getRecords() {
var feeds = "";
var def = $.Deferred();
var db = window.openDatabase("Database", "1.0", "MyDB", 200000);
db.transaction(function(tx) {
var db = window.openDatabase("Database", "1.0", "MyDB", 200000);
tx.executeSql("SELECT AccountName,ContactNumber FROM BILL_TABLE", [], function(tx, results) {
var len = results.rows.length;
var feedarray = [];
for (var i = 0; i <=len-1; i++) {
var len = results.rows.length;
var roaObj =results.rows.item(0);
var jsonString=JSON.stringify(roaObj);
feedarray.push(jsonString);
}
console.log(feedarray);
feeds = {
data: feedarray, // provide array, not a string here too
itemsCount: len
};
console.log(feeds);
def.resolve(feeds);
});
});
return def.promise();
}
Thanks,
John
On May 29, 2015, at 3:42 PM, Artem Tabalin [email protected] wrote:
feeds = {
data: [items] // provide array, not a string here too
itemsCount: len
};
def.resolve(feeds);
from jsgrid.
You are right, the format of objects in array is incorrect. You provide them as strings, but elements of data
array should be also js objects. You can see the problem in console, where object is printed in quotes.
from jsgrid.
Thanks so much for your help. It is now working for me.
On May 31, 2015, at 5:27 PM, Artem Tabalin [email protected] wrote:
You are right, the format of objects in array is incorrect. You provide them as strings, but elements of data array should be also js objects. You can see the problem in console, where object is printed in quotes.
—
Reply to this email directly or view it on GitHub #35 (comment).
from jsgrid.
You are always welcome!
from jsgrid.
Related Issues (20)
- Trying to use edit template to create a blank text box. HOT 1
- JsGrid with fully working multiselect
- MyDateField issue
- text not showing foe select field after insert data and edit data in jsGrid
- Vertical Scroll Bar Hiding Controls Column HOT 3
- event on cell value change HOT 1
- Can't customize the control button
- Feature Request / Help - Want to set default filtering options
- Changing pageSize reloads the data in grid.
- How to implement Hierarchical Grid on n level.
- Difference between itemTemplate and cellRendering
- How to add subgrid in parent grid HOT 1
- Js grid get cell value cellClick HOT 2
- Need help datetime-local HOT 1
- Is there an official fork that is being heavily used and actively maintained? HOT 1
- Jsgrid select with search box HOT 1
- Detect value of selected value when inserting a new item
- 数据操作时,有没有直接失去焦点保存数据?
- JS grid load data above 5000
- editTemplate on row change error throw $inputFrom was not an function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsgrid.