timeglider / jquery_widget

Timeglider's JS Widget component. See README for details.
193 stars 41 forks source link

Allow loading JSON from an existing object/string #38

Open capeterson opened 12 years ago

capeterson commented 12 years ago

Background: I'm looking at using timeglider in an open-source project that runs on top of salesforce.com, which means I'm stuck and/or blessed with following the way their platform runs. While on salesforce it's possible to have a "normal" ajax URL that returns a JSON string, it has extra overhead performance-wise and is a sperate "page" that has to have access granted for it, making this approach sub-optimal.

WIth that said, they have a very nice system that allows you to annotate a method and have it directly callable from within a page, e.g. the javascript String someJSON = myClass.getJSON(); would handle all the work of making the "AJAX" request, escaping it, etc. for me. However, I can't use this approach with timeglider as it required a URL to fetch data from, and doesn't seem to be able to directly accept a string or object to use as a data source. If this were possible it would make my life much easier, and in one use case would prevent the same data from being generated twice on the server side.

timeglider commented 12 years ago

Hi Chris

You can use a data object rather than a URL for loading into Timeglider: it just has to have the same properties the JSON would have had. Try loading a data object that's just like timeglider JSON into the "source" option for the widget.

Out of curiosity, can you tell me more about the open source project you're using? While I'm excited about integration with Salesforce, Timeglider has a commercial/non-commercial license structure. If you're doing something "non-commercial", it's free, but there is a license fee for commercial use.

Email me directly about this, since it's not code/git related: michael@timeglider.com

Thanks!

On Tue, Feb 21, 2012 at 2:46 PM, Chris Peterson < reply@reply.github.com

wrote:

Background: I'm looking at using timeglider in an open-source project that runs on top of salesforce.com, which means I'm stuck and/or blessed with following the way their platform runs. While on salesforce it's possible to have a "normal" ajax URL that returns a JSON string, it has extra overhead performance-wise and is a sperate "page" that has to have access granted for it, making this approach sub-optimal.

WIth that said, they have a very nice system that allows you to annotate a method and have it directly callable from within a page, e.g. the javascript String someJSON = myClass.getJSON(); would handle all the work of making the "AJAX" request, escaping it, etc. for me. However, I can't use this approach with timeglider as it required a URL to fetch data from, and doesn't seem to be able to directly accept a string or object to use as a data source. If this were possible it would make my life much easier, and in one use case would prevent the same data from being generated twice on the server side.


Reply to this email directly or view it on GitHub: https://github.com/timeglider/jquery_widget/issues/38