YUI Datatable to JS object - javascript

I have a problem. I have YUI DataTable and i need convert it to JS object. But I'm not found standart ways for this. If anyone know, how to solve this problem - please answer.
Thank you.

Since YUI 3.5.0 you just need to do datatable.get('data').toJSON(). datatable.get('data') now returns a Y.ModelList which in turn has a toJSON method.

Related

What is equivalent to Datatables iSortCol_0 in Datatables 1.10.2?

I tried to update my datatable to the newest datatable version but I dont find an answer what the old variables called iSortCol_0 and sSortDir_0 are called in the Datatables 1.10.2. Does someone know that?
Thank you in advance.
So I got the answer myself. The iSortCol_0is called order[0][column] in the new version and the sSortDir_0 is called order[0][dir]. I realized that the documentation of the datatable tools ist not fully completed yet so be carefull if you use it in the future.

Angular Polymer data-binding

I want to make two way data binding between Polymer and Angular, for this I am using Angu-poly library.
Here is a link to an example which is working, while passing strings via name and age attributes: working.
<x-kid bind-polymer ng-repeat="kid in kids" angupoly="{name:'kid.name', age:'kid.age'}">
</x-kid>
But when I try to make it with passing an object via kid attribute, it seems that something goes wrong, here is the link: not working.
<x-kid bind-polymer angupoly="{kid:'kid'}">
</x-kid>
What should I do to make it work?
Update:
Also tried it with this library and it didn't work. the code will look like this:
<x-kid bind-polymer kid={{kid}}>
</x-kid>
Big Update:
Here I made some progress tweaking the "angular-bind-polymer" library. For now I am able to bind objects from outside polymer into polymer, here is the updated plunker. The problem now is to do this in the other direction.
Note: I am getting some exception from angular side, take a look maybe you can help to solve it. I think we are very close :).
Here is an updated example http://plnkr.co/w1icAU
With Polymer 1.0 two way binding is much simpler and also able to bind objects not just string values.
Here is the main part
<x-kid ng-repeat="kid in ::kids" angupoly="{name:'kid.name', age:'kid.age'}"></x-kid>
I think it is because of some kind of reference.
How should I explain, just like you work with object in scope in data binding. when you update the object to a new object, the UI will not update with new object values.
It looks that Material Design is THE answer, excerpt:
Our goal is to deliver a lean, lightweight set of AngularJS-native UI elements that implement the material design system for use in Angular SPAs.
Maybe you could find clues from this blog even if its aim is for dart:
Angular and Polymer Data Binding, Together!
Also take a look at ng-polymer, this project may help give you some insight

jQuery.data('itemname') not working but jQuery.attr('data-itemname') is working

This is weird behavior but when I am trying to access some data attribute using jQuery data() function, it is returning me undefined but attr() is returning me the actual value. I know data works differently as it caches for the first time and then it retrieves from cache. I am using jQuery 1.4.2 and then tried looking with jQuery 1.7.1 and it did work. But I can't upgrade to 1.7.1 at the moment. Any thoughts on it??
I will appreciate any kind of suggestion or help provided
HTML5 data-* objects being pulled into .data was not done until jQuery 1.4.3: http://api.jquery.com/data/#data-html5
Maybe you can just update to 1.4.3?
You answered your own question: data doesn't work in jQuery 1.4.2. If you can't upgrade, you try this plugin.

Jquery Date Calculations JQUERY4U

I've been trying tom implement the following script which looks like a great date calculation library built on top of Jquery.
http://www.jquery4u.com/jquery-functions/datetime-functions-complete-listing/
My basic knowledge of Jquery and Javascript isn't sufficient to get this working so I'm looking for some help with the usage.
I've loaded the file in the header of the page I want to use it and tried unsuccessfully to call the functions like:
JQUERY4U.DATETIME.futureDateDays(1);
DATETIME.futureDateDays(1);
futureDateDays(1);
And an assortment of other attempts just doesn't seem to work. I know I'm probably missing something easy.
My goal is to set a variable to the result of the datetime function.
Also, it would be great if you could provide examples for the usage of the date format portion of the script.
I know some of you Jquery and Javascript ninjas will be able to figure this out in under 90 seconds.
Thanks in advance!
Here's a jsFiddle that should have what you need:
http://jsfiddle.net/dKGkY/1/
There are three functions that you would need, and hopefully there's enough in the examples to explain what they do. You can obviously change whatever you need for your requirements, but hopefully this is what you need! Let me know if you need helping modifying or using them.

How to convert string to JSON object?

I am using jquery 1.3.2 and I can't use the parseJSON since it is added in 1.4.1 & I can't upgrade right now.
Is there any wat to get JSON object from string?
If this is a duplicate please send me the link.
Thanks for reading
You can use a couple of options, see here
Javascript eval function
JSON.parse() function
The eval function has some security issues associated with it, and the JSON.parse function has its own set of incompatibilities. I guess this is why JQuery has its own wrapper function. If you can't use JQuery 1.4+ though, these are two of your best options, without going looking for a specific JSON parsing library.
json2.js : http://www.json.org/js.html

Categories

Resources