Dropdown list and record limit

QuestionsDropdown list and record limit
Paolo D. asked 3 years ago

Hi,
I followed the general instructions to create a dropdown list in building a form that inserts a ticket for a client and gets the client code and name for the dropdown list from an external MSSSQLSERVER.

This is the select for the dropdown:

$str = $g->get_dropdown_values("select top (250) codconto as k, (dscconto1 + ' – ' +codconto) as v from view_Acf");

The view named "view_acf" is on the same server as the general DB but it gets all the data (client code and client name) from a linked server.

I had to limit the record set to 250 results because if I try 500 the result is a blank page.

I've seen in the forum similar problems in case of exports but in those cases the users were having problems with 100.000 records, not 3.000 (which would be my maximum number of results, should the query complete).

I noticed that if I select the values for the dropdown list from a Table in the main DB the maximum number of records goes up to 2.500.

How can I fix this problem?

Thanks

5 Answers
Abu Ghufran answered 3 years ago

You can try enabling debug mode:
$g = new jqgrid($db);

$g->con->debug = 1;

And see if there are some error messages from database.
If there is, you can try searching solution on stackoverflow or reply back here.

Paolo L. answered 3 years ago

Hi,

there is no SQL error I can see. The grid reports the queries that are being executed (I tried them in the sql server and they all run without problem). Here is the debug result:
(mssqlnative): select top (250) codconto as k, (dscconto1 + ' – ' +codconto) as v from view_Acf
(mssqlnative): select top (1+0) ITEM_ID, ITEM_CODE, ITEM_DESCR, ITEM_SERIAL, ITEM_CLIENT_CODE, dscconto1 from admin_sa.items left outer join view_Acf on item_client_code=codconto WHERE 1=1

Then, on the popup relating to the grid:

mssqlnative): select top (250) codconto as k, (dscconto1 + ' – ' +codconto) as v from view_Acf
(mssqlnative): select top (1+0) ITEM_ID, ITEM_CODE, ITEM_DESCR, ITEM_SERIAL, ITEM_CLIENT_CODE, dscconto1 from admin_sa.items left outer join view_Acf on item_client_code=codconto WHERE 1=1
(mssqlnative): SELECT count(*) as c FROM (select ITEM_ID, ITEM_CODE, ITEM_DESCR, ITEM_SERIAL, ITEM_CLIENT_CODE, dscconto1 from admin_sa.items left outer join view_Acf on item_client_code=codconto WHERE 1=1) pg_tmp
(mssqlnative): select top (30+0) ITEM_ID, ITEM_CODE, ITEM_DESCR, ITEM_SERIAL, ITEM_CLIENT_CODE, dscconto1 from admin_sa.items left outer join view_Acf on item_client_code=codconto WHERE 1=1 ORDER BY item_id ASC
{"page":1,"total":1,"records":17,"rows":[{"ITEM_ID":"4","ITEM_CODE":"Mouse-22","ITEM_DESCR":"Mouse Wifi","ITEM_SERIAL":"323-dwd-23d","ITEM_CLIENT_CODE":"C 1","dscconto1":""},{"ITEM_ID":"5","ITEM_CODE":"Keyboard_3312","ITEM_DESCR":"Keyb Italian","ITEM_SERIAL":"ffvf-323-32e567-dsd","ITEM_CLIENT_CODE":"C 1","dscconto1":""},{"ITEM_ID":"6","ITEM_CODE":"PC HPsasa","ITEM_DESCR":"PC","ITEM_SERIAL":"51616-5151","ITEM_CLIENT_CODE":"C 0013","dscconto1":""},{"ITEM_ID":"7","ITEM_CODE":"dsad","ITEM_DESCR":"qqw12","ITEM_SERIAL":"12123","ITEM_CLIENT_CODE":"C 1","dscconto1":""},{"ITEM_ID":"8","ITEM_CODE":"1212","ITEM_DESCR":"dasdsa","ITEM_SERIAL":"dasdsd","ITEM_CLIENT_CODE":"C 0013","dscconto1":""},{"ITEM_ID":"9","ITEM_CODE":"ccx","ITEM_DESCR":"cxzxc","ITEM_SERIAL":"cxzcxz","ITEM_CLIENT_CODE":"C 0044","dscconto1":""},{"ITEM_ID":"10","ITEM_CODE":"sette","ITEM_DESCR":"dsd","ITEM_SERIAL":"dsdsd","ITEM_CLIENT_CODE":"C 1","dscconto1":""},{"ITEM_ID":"11","ITEM_CODE":"x

I tried also reducing the number of rows displayed on each page but to no avail

Paolo L. answered 3 years ago

Update:
adding the line

echo $g->con->ErrorMsg();

it says "No errors found"

Abu Ghufran answered 3 years ago

I am sending you remote session request.
I'll review after checking.

Paolo L. answered 3 years ago

The problem originated from a client code which contained an à.
Abu fixed it by modifying the file jqgrid_dist.php:

$str[] = $rs["k"].":".utf8_encode($rs["v"]);)

He added the .utf8_encode part and everything run smoothly

Txs!

Your Answer

3 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!