Comments (6)
Hi there and thanks for posting this question! I appreciate all the detail you put into describing the issues you are running into.
It seems that the external results is one area we need to document at bit better. In the near future here we'll write a much more thorough example of using the external results and hopefully clean up some of the issues that are commonly encountered with that part of Griddle. I hope to have that online by this weekend.
Thanks again for being a first time Github poster on our repository :)
from griddle.
For anyone else that is coming from jQuery datatables, I make an ajax call using the https://github.com/ded/reqwest library (so I don't have jquery at all in my project). This works very similarly to jQuery's $.ajax({
by using Reqwest({
instead.
Then I need to modify some things with the results returned, so I make a temporary results
array as follows:
success: function (resp) {
var results = [];
for (var i=0; i<resp.iTotalDisplayRecords; i++)
{
results[i] = {
"Path" : resp.aaData[i]["FilePath"],
"Last Seen": resp.aaData[i]["LastSeen"],
"First Seen": resp.aaData[i]["FirstSeen"],
"Count": resp.aaData[i]["NumSystems"]
};
}
callback({
results: results,
totalResults: resp.iTotalRecords
});
},
from griddle.
What about when you do an ajax call on form submit? This is the only workaround I've found:
loadItUp: function(filterString, sortColumn, sortAscending, page, pageSize, callback, e) {
if(e) {
$.ajax({
url: 'musings.json',
dataType: 'json',
success: function(data) {
callback({
results: data,
totalResults: data.length
});
}.bind(this),
error: function(xhr, status,err) {
console.error(xhr, status, err.toString());
}.bind(this)
});
} else {
callback({
results: data,
totalResults: data.length
});
}
},
handleSubmit: function(e) {
e.preventDefault();
this.loadItUp(null, null, null, null, null, function(){}, e);
return;
},
render: function() {
return (
<form onSubmit={this.handleSubmit}>
<Griddle getExternalResults={this.loadItUp} tableClassName="table" />
</form>
)
}
It works but it kinda defeats the purpose of using ReactJS state/props plus it feels wrong. =/
from griddle.
Hey @sam3k -- thanks for posting! I agree -- we are currently refactoring the external results to be more react-y. It's working on our manual examples but I'm trying to get more tests around the functionality and shim in the callback (so we don't break the grid for anyone using the callback method in the immediate future) before pushing it to the released version.
This functionality is available on this branch and once more of the tests are done it will be in npm as a pre-release version.
from griddle.
Using that branch (and switching to "results" instead of "getExternalResults" works perfect. Thanks @ryanlanciaux
from griddle.
I'm closing this out as the ver0.2.0 release should have made this sort of thing a bit easier. The external data documentation contains some better example than the original docs. Please feel free to ping me if this is still giving you trouble! 👍
from griddle.
Related Issues (20)
- Griddle ignoring Custom columnMeta and my custom LinkComponent. HOT 3
- React-Redux 6.0.0 Upgrade fails with : TypeError: state.get is not a function HOT 11
- Getting started example doesn't work HOT 2
- Incorrect docs example for custom filter component HOT 1
- Griddle columnMetaData not being used
- "Customization section" link in "Getting started" docs doesn't work if accessed directly via nav
- Cannot Filter on Nested Data using LocalPlugin HOT 1
- Need help maintaining Griddle HOT 8
- Directly Only Show Rows Per Page instead of whole settings component HOT 1
- add link in a row HOT 1
- No results found wording
- RowEnhancer Dynamic Content Causing Re-render HOT 1
- Use only the parts of lodash that are used HOT 1
- Question: package.lock and yarn.lock both exist HOT 1
- Storybook has a failing case on master HOT 2
- Leak of memory HOT 1
- How to set the filter text externally HOT 1
- Column headings should not be selectable on double-click
- `customComponent` of type `object` supplied to `ColumnDefinition`, expected `function`. in ColumnDefinition in new griddle-react HOT 1
- Financing 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 griddle.