Select2 not showing in DV

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
Post Reply
ckebbell
Veteran Member
Posts: 32
Joined: 2020-01-28 18:09

Select2 not showing in DV

Post by ckebbell » 2020-07-16 02:12

hi all

Another thing I am having a problem with. One of the Select2 fields (Item) in my table DV is not working. This is an issue, as the user has to select a Product using this field :x The Description field is an autofill, based on the user selection of Item. The Price and subtotal depend on this field to calculate - currently, the only way I have to populate this field is to import a CSV or go into phpmyadmin... which is not practical for my users!
JobItems.JPG
JobItems.JPG (34.56 KiB) Viewed 2949 times
The other Select2 fields in the same table work ok. I have taken 2 screenshots of the Appgini set up - siteid is working, Item is not working.
JobItemsSite.JPG
JobItemsSite.JPG (75.12 KiB) Viewed 2949 times
JobItems.JPG
JobItems.JPG (84.34 KiB) Viewed 2949 times
I have searched the forum and tried a few hints from other posts (e.g. K Krishnamoorthy and changing the width to 100%) but it has not solved the problem.

Does anyone have experience of this? I recall it happened to me around 6 years ago and regenerating the app solved the issue. But I have now regenerated the app 6 times over the last 3 days and it is still not working!! I have generated to a brand new folder, I have overwritten files, I have tried a lot of things. The issue was happening on another Select2 in another table - regenerating the table solved the issue with that table but this field is particular stubborn and refuses to show anything. It worked fine on my local xampp server, then I regenerated the app with a few changes, uploaded to a webserver and it has broken.

Any ideas or hints on how to fix or resolve this issue?

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Select2 not showing in DV

Post by jsetzer » 2020-07-16 05:04

Please check permissions on items table.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

ckebbell
Veteran Member
Posts: 32
Joined: 2020-01-28 18:09

Re: Select2 not showing in DV

Post by ckebbell » 2020-07-16 08:43

Thank you Jan! Do you mean check the box "inherit access permissions"? I am logged in as admin, so I should be able to see this table anyway...

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Select2 not showing in DV

Post by jsetzer » 2020-07-16 12:55

Sorry, if you are logged in as admin, this will not be the reason usually. In this case, forget about me recent post.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Select2 not showing in DV

Post by pfrumkin » 2020-07-16 20:06

What is the SQL for the lookup? I see that siteID is a varchar and item is an integer, so I suspect that item is a link to a record (primary key?) in the products table, while the siteID is the actual value. Not sure that matters at all, just looking at what is different between the two.

ckebbell
Veteran Member
Posts: 32
Joined: 2020-01-28 18:09

Re: Select2 not showing in DV

Post by ckebbell » 2020-07-16 21:29

Hi pfrumkin

Thank you for looking! I checked ajax_combo.php to see what the sql for the lookup is. It is looking for an integer, the entry in ajax_combo.php is

Code: Select all

'Item' => array(
	'parent_table' => 'Products',
	'parent_pk_field' => 'id',
	'parent_caption' => 'IF(CHAR_LENGTH(`Products`.`ProdCode`) || CHAR_LENGTH(`Products`.`Item`), CONCAT_WS(\'\', `Products`.`ProdCode`, \'>>\', `Products`.`Item`), \'\')',
	'parent_from' => '`Products` LEFT JOIN `Suppliers` as Suppliers1 ON `Suppliers1`.`id`=`Products`.`Supplier` ',
	'filterers' => array(),
	'custom_query' => '',
	'inherit_permissions' => true,
	'list_type' => 0,
	'not_null' => false
	),
I think this looks correct? As you can see from the screenshot, I have 3x Select2 fields in this table. One is a lookup from Sites, one is from Jobs and one is from Products. Both the Sites and Jobs Select2 fields work perfectly and are visible in the modal view. It is only the Item Select2 field that is not visible (and therefore not selectable).

For more information
I have another table, called KitItems. This table has the same Item field as JobItems (they are both lookups to the Products table) and the modal view for KitItems works perfectly. The entry in Ajax combo is the same as above.

So I checked the entries in the template DV files! These are the same too.

The only difference between the tables is that KitItems also has a supplier field and the Items field is filtered by the Supplier selection. Supplier was not necessary in the Job_Items table.

Does anyone have any other ideas of where I could check to see if there is any different between KitItems.Item and Job_Items.Item?


Thank you for any help or pointers you can give.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Select2 not showing in DV

Post by pbottcher » 2020-07-17 10:57

Hi,

can you change once the datatype of the job_items.siteid to integer and test.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

ckebbell
Veteran Member
Posts: 32
Joined: 2020-01-28 18:09

Re: Select2 not showing in DV

Post by ckebbell » 2020-07-20 00:17

Hi pbottcher

I will try that and report back.

I wanted to check first - the field type of the PK field (siteid) in the Sites table is a varchar field. Siteid is in the format @@@### ( for example ABC001). So the lookup works perfectly in the table Job_Items (and in the 6 other tables that use Sites.siteid as a lookup).

The field type of the PK field for the Products table is an integer. It works perfectly in another table I have that uses the same lookup (KitItems). It just doesn't work in this table Job_Items. Here are screenshots from both fields (Job_Items.Item and KitItems.Item)
JobItems.JPG
JobItems.JPG (73.09 KiB) Viewed 2804 times
KitItems.JPG
KitItems.JPG (79.58 KiB) Viewed 2804 times
I don't understand why Kit Items works but Job Items doesn't?

ckebbell
Veteran Member
Posts: 32
Joined: 2020-01-28 18:09

Re: Select2 not showing in DV

Post by ckebbell » 2020-07-20 22:50

Thanks to the very kind assistance of pbottcher, I deleted and recreated the field. It now works perfectly! I must have copied it from another table at some point and it has an incorrect setup.

Deleting the field and recreating has fixed the issue.

Post Reply