Page 1 of 1

Appgini Helper - hidden drop down causing issue

Posted: 2022-02-24 15:28
by angus
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");

Re: Appgini Helper - hidden drop down causing issue

Posted: 2022-02-24 15:41
by jsetzer
Please post the errors which are listed in console tab of dev Tools.

Re: Appgini Helper - hidden drop down causing issue

Posted: 2022-02-24 15:50
by angus
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"); 

Re: Appgini Helper - hidden drop down causing issue

Posted: 2022-02-24 16:01
by jsetzer
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"); 

Re: Appgini Helper - hidden drop down causing issue

Posted: 2022-02-24 16:48
by angus
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 3733 times

Re: Appgini Helper - hidden drop down causing issue

Posted: 2022-02-24 17:00
by jsetzer
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?