Lui Cruz
Lui Cruz

Reputation: 81

quickblox - javascript can i get list of users sort by name?

I would like to get the list of users ordered by name and with the new users first. I've used the documentation reference: http://quickblox.com/developers/Users#Sort

I've trying this code but it is not working at all:

function QBlistUsers(page) {
    var userParams = {};
    var page = currentPage;
    {userParams.perPage = itemsPerPage;}
    {userParams.pageNo = page;}
    {userParams.order = ['desc','string','full_name'];}

    //{userParams.order = 'desc+string+full_name';} // I've try this too, instead of the previous line


//load new rows per page
QB.users.listUsers(userParams, function(err, response){...}

The response is simply ignoring the param "order". I'm I doing something wrong?

thanks for helping

Upvotes: 1

Views: 783

Answers (3)

WebDev
WebDev

Reputation: 256

Look at new version of JS SDK 1.2.0:

http://quickblox.com/developers/Javascript

var params = {
  order: { sort: 'desc', field: 'full_name' },
  per_page: itemsPerPage,
  page: page
};
QB.users.listUsers(params, function(error, response){
  // callback function
});

Upvotes: 2

WebDev
WebDev

Reputation: 256

Current version of WebSDK supports only 'in' parameter from Users filters. But we are already working on new version which will have all these filter cases. I think, through two / three days it will be released.

Upvotes: 1

Bluewings
Bluewings

Reputation: 3488

Try passing the order parameter like below and let me know whether it is working or not.

QB.users.listUsers({ order:'desc'+'string'+'full_name'}, function(error, response){ if(error) { console.log(error); } else { // Success } });

Upvotes: 0

Related Questions