Appgini Helper - hidden drop down causing issue

This sub-forum is for discussing all topics related to AppGini Helper JavaScript Library, provided by bizzworxx as a third-party AppGini plugin.
Post Reply
angus
Veteran Member
Posts: 109
Joined: 2020-05-28 22:27

Appgini Helper - hidden drop down causing issue

Post by angus » 2022-02-24 15:28

Hi Jan, apologies for the topics today. I have searched this but cannot find a solution.

My drop down is conditionally hidden based on your tutorial. This all works great. However, when I add the beautify buttons, the form doesnt display correctly (just one long list)

I tried to get the container ID, and using your example previously of testing if it existed first before it applied the changes but this does not work, the only error says there is an "Uncaught SyntaxError: Unexpected token '.' " on the last row of the code below. Do you have any guidance you could maybe help me with?

Code: Select all

var btnPR = ("#s2id_Test-container");
if (btnPR !== null) 
var field = new AppGiniField("Test");
var dropdown = field.dropdown();
dropdown.fix("pencil", "plus");
var btnAdd = dropdown.getAddButton();
if (btnAdd !== null) btnAdd.appendIcon("user").appendText(" New Test Reason");
var btnView = dropdown.getViewButton();
if (btnView !== null).appendText(" Edit");
AppGini 22.13

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

Re: Appgini Helper - hidden drop down causing issue

Post by jsetzer » 2022-02-24 15:41

Please post the errors which are listed in console tab of dev Tools.
Kind regards,
<js />

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

angus
Veteran Member
Posts: 109
Joined: 2020-05-28 22:27

Re: Appgini Helper - hidden drop down causing issue

Post by angus » 2022-02-24 15:50

the only error says there is an "Uncaught SyntaxError: Unexpected token '.' " ROW 31.

Row 31 was the last line of the code I posted.

Code: Select all

 if (btnView !== null).appendText(" Edit"); 
AppGini 22.13

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

Re: Appgini Helper - hidden drop down causing issue

Post by jsetzer » 2022-02-24 16:01

Yes, you have a syntax error in your code. The message already tells the reason.

Your if-condition evaluates to true or to false, not to an jQuery element. True/False are boolean values, not objects. Boolean values don't have a method called appendText().

I think you have missed btnView

Code: Select all

 if (btnView !== null) btnView.appendText(" Edit"); 
Kind regards,
<js />

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

angus
Veteran Member
Posts: 109
Joined: 2020-05-28 22:27

Re: Appgini Helper - hidden drop down causing issue

Post by angus » 2022-02-24 16:48

Thanks Jan, I did not spot this, I fixed it but get another error. I think it is down to trying to modifiy the buttons but they are being hidden (not sure though)

console error.png
console error.png (8.25 KiB) Viewed 771 times
AppGini 22.13

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

Re: Appgini Helper - hidden drop down causing issue

Post by jsetzer » 2022-02-24 17:00

Remember that lookups are lazy loaded. Perhaps you do not wait for dv.ready and already try to customize a dropdown which does not exist, yet?
Kind regards,
<js />

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

Post Reply