Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filtering JSON data

I have a JSON file which contains data like the following:

{"posts": [ 
    { "title":"1", "url":"n1.png" }, 
    { "title":"2", "url":"n2.png" }, 
    { "title":"3", "url":"n3.png" }, 
    { "title":"4", "url":"n4.png" }, 
    { "title":"5", "url":"n5.png" }, 
    { "title":"6", "url":"n6.png" }, 
    { "title":"7", "url":"n7.png" }, 
    { "title":"8", "url":"n8.png" }, 
    { "title":"9", "url":"n9.png" }, 
    { "title":"10", "url":"n10.png" }
]}

I need to filter title by range with two text boxes: from and to.

like image 824
ganesh Avatar asked Feb 28 '12 14:02

ganesh


1 Answers

There is another solution to this: using jLinq.js (documentation), which has even more features. In this case, you can get the solution by using the following code:

var selectedPosts = jLinq.from(posts)
                         .betweenEquals("title",4,8)
                         .select();
like image 91
Krishna Sapkota Avatar answered Oct 01 '22 08:10

Krishna Sapkota