Hello again, im trying to resolve a problem with the select/options in Drupalgap, the problem is that i cannot make it work with more than 20 items.

CommentFileSizeAuthor
#3 fotoindexqueries.jpg157.83 KBHomerO

Comments

tyler.frankenstein’s picture

Category: Feature request » Support request
Status: Active » Postponed (maintainer needs more info)

Any time a Service Index is used, and the results are greater than 20, it limits it to 20. You can try enabling this permission for user roles to get more results:

Perform unlimited index queries

As for the second problem, please don't put two issues into one issue queue. Please remove the second issue from here, and give it it's own issue for help.

HomerO’s picture

I enabled permissions for all kind of users and it's not working either so i tried modifing the services module, but i managed to restrict to 10 only.

HomerO’s picture

StatusFileSize
new157.83 KB
HomerO’s picture

Issue summary: View changes
tyler.frankenstein’s picture

Version: 7.x-1.11 » 7.x-1.x-dev
Component: Module Code » Mobile Application Development Kit Code
Issue tags: -select, -taxonomy

You'll have to use one of DrupalGap's service preprocess hooks in a custom DrupalGap module's .js file to tell Services how many items you want back. You do this by appending a `&pagesize=100` to the query string generated by jDrupal. http://api.drupalgap.org/

HomerO’s picture

I couldn't see your answer because i was working, so i finally solved it in some other way...

The code i used is this

function services_resource_build_index_query($query, $page, $fields, $parameters, $page_size, $resource) {
  $default_limit = variable_get("services_{$resource}_index_page_size", 100000);
  if ('perform unlimited index queries') {
    $page_size = $default_limit;
  }

So what the modified code does, is that the default limit is 100000 without asking if the user is authenticated or not... Hope this helps someone with the same problem. Thank you Frank!!!

dan1eln1el5en’s picture

Hey sorry to interrupt this issue, but I have the same.

I've added the above code to a custom module (a module created to alter the add node form) shouldn't this work ? or where did you add this code ?

or can the form be altered with something like :

form.elements.field_sted_cat.content = {
			params: '&pagesize=100'
    	};

?

tyler.frankenstein’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

@dan1eln1el5en, no that won't work. You need to use the pre/post process service hooks in DrupalGap (or the corresponding service hooks in Drupal) to rewrite the index query before it is executed.

nithinkolekar’s picture

Status: Closed (works as designed) » Active

This bug is still present when tested with user(1) and "Perform unlimited index queries" set to true. I don't get whether this is Services module limitation or not, because all filter values are showing in the views preview page but not in web-app configured using drupalgap.

More strangely first few values are omitting from the filter value. for ex: if we have alphabet values A to Z then in the filter values from G to Z are showing (i.e total 20 items).

tyler.frankenstein’s picture

Status: Active » Postponed (maintainer needs more info)

By default Services sets it to 20 by using (http://cgit.drupalcode.org/services/tree/resources/taxonomy_resource.inc...):
variable_get('services_taxonomy_term_index_page_size', 20)

You can try this via Drush:

drush vset services_taxonomy_term_index_page_size 40

Or you can add this to your settings.php file:

$conf['services_taxonomy_term_index_page_size'] = 250;

Be sure to flush all Drupal caches afterwards so the Service Resources are rebuilt.