I use this query to populate my gallery:
var queryGallery = "$select=Title,Description,Enlace,EncodedAbsUrl,Categoria/Title&$expand=Categoria/Title";
$.ajax({
url: url + "/_api/web/lists/getbytitle('" + listname + "')/items?$top=1000&" + queryGallery,
//url: url + "/_api/web/lists/getbycategory('Office'),
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function (data) {
completeGalleryContent(data, target, eng);
},
error: function (data) {
failureGalleryContent(data, target);
}
});
}
The problem is that I don´t know why first take one image of each category and after that get all images of one categorie, for example I have this categories
Services, Home, Office
In my first row of images I get:
firstimageServices
firstimageHome
firstimageOffice
secondimageOffice
thirdimageOffice
etc...
But I want to group all by categorie, so it will be:
firstimageServices
secondimageServices
thirdimageServices
fourimageServices
etc...
firstimageHome
secondimageHome
thirdimageHome
fourimageHome
etc...
firstimageOffice
secondimageOffice
thirdimageOffice
fourimageOffice
etc..
How can I do in my query to group it? Regards!
Note: I look something of interest in these link msdn but how can I apply it in my query to sort by "Categoria"
$orderby=Categoria,Title asc
to queryGallery?var queryGallery = "$select=Title,Description,Enlace,EncodedAbsUrl,Categoria/Title&$expand=Categoria/Title$orderby=Categoria,Title asc";
but It don´t pass to data, I review my question and I need to sort by Title so I do that: "$select=Title,Description,Enlace,EncodedAbsUrl,Categoria/Title&$expand=Categoria/Title$orderby=Title asc";` but don´t works too@EricAlexander