Comments (4)
Hey Nick,
I'm not quite sure I understand. Are you saying you'd like to render HTML like...
<ol>
<li>The Title of Something</li>
<li>Something Else</li>
<li>And a Third</li>
</ol>
...and have Marco Polo automatically search through those?
An example of what you're doing would be helpful. Thanks!
from jquery-marcopolo.
Well generally speaking yes. I would like something like this. You see it's really easy to render list of partials but having 2 set of templates is quickly becomes tiresome especially when you have complex objects to render.
Instead of, say:
[
{
"id": 1,
"title": "Whatever",
"body": "Text goes here"
...
"nested": { }
},
{...},
{...},
]
I would like to be able to accept an html collection like this (since Marcopolo expects JSON without a root node I think flat list would be more appropriate, plus it's more convenient to render).
<div id="object_1" class="object">
Complex output here
</div>
<div id="object_2" class="object">
...
</div>
So I don't have to render each item in Javascript. Is there any clever trick to do so?
from jquery-marcopolo.
I don't think there's a clever trick to get that working right now. Since Marco Polo expects the response from the url
endpoint to be JSON, it'll error out with anything like XML or HTML. Support for those could probably be built in, but it's not something on the horizon.
My suggestion for now would be to use something like ActiveModel::Serializers to output the JSON, rather than templates/partials. That should be a bit easier to maintain.
from jquery-marcopolo.
Thanks. Thats what I do, I don't have problems with rendering models to JSON. The tricky part is rendering them back to HTML in Marcopolo.
from jquery-marcopolo.
Related Issues (20)
- Examples page does not exist HOT 2
- local json data HOT 1
- Breaking with jQuery 1.8.x HOT 2
- Features HOT 5
- 'required' feature remains after destroy HOT 5
- Marco Polo doesn't show Empty Results in IE8 HOT 3
- Custom css-classes or even custom templates for results HOT 1
- formatData is a bit misleading name HOT 1
- Localization HOT 1
- suggestions for sending multiple params with the input? HOT 2
- No way to use [home] or [end] keys to navigate/select text HOT 4
- Support for results sections. HOT 1
- Clearing the cache HOT 19
- formatNoResults not showing HOT 1
- Option to bind the result list to another element HOT 1
- Cant set initial value HOT 5
- Cache invalidate HOT 1
- Hide result numbers HOT 1
- Make a GET request on mouse input. 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 jquery-marcopolo.