Source language: Translate to:

DOM selection

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

DOM selection

Postby luishp » Wed Feb 04, 2015 3:15 am

¿How to access a DOM element through JavaScript?
I have try $("#elementID") and document.getElementById("elementID") but i'm not sure this is correct in AngularJS.
The SetAttribute command seems not to work for objects out of the current page and properties values are reseted whenever you leave and return to the current page.
Thanks!
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Re: DOM selection

Postby Neosoft Support » Wed Feb 04, 2015 12:29 pm

This seemed to work for me:

$( '#Paragraph1' ).html( '<p>Hello</p>' );

The object ID '#Paragraph1' is case sensitive.

You can also use the angular.element function to access the DOM. For example:

angular.element( '#Paragraph1' ).html( '<p>Hello</p>' );

This didn't seem to work any differently from the JQuery method above.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: DOM selection

Postby luishp » Thu Feb 05, 2015 2:05 am

Thanks Dave for your answer.

Any of these seems to work but only when Image1 is in the current page:

Code: Select all
SetAttribute #Image1 "width" "120px"
document.getElementById("Image1").style.width="120px";
$("#Image1" ).css("width","120px");
angular.element("#Image1").css("width","120px");


But if you leave the page "GotoNextPage" and then enter again "GotoPrevPage", the attribute "width" will be reseted to its original value.
I'm not sure if this is a bug or not.
Is there anyway right now to permanently change an object attribute even outside the current page?
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 357
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Re: DOM selection

Postby Neosoft Support » Thu Feb 05, 2015 12:00 pm

Is there anyway right now to permanently change an object attribute even outside the current page?


There isn't a solution in the current version, but I think there will be soon. The problem is that only objects on the current page are loaded into memory, so only those objects can be modified. When you leave the current page its objects are removed from memory and the new page's objects loaded in its place.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: DOM selection

Postby Gaev » Thu Feb 05, 2015 1:11 pm

Dave:

There isn't a solution in the current version, but I think there will be soon.

Will there be event sections in NeoAppBuilder for "Page Enter" and "Page Exit" ... like we have with NeoBook ?

If so, an interim solution would be for developers to save/restore such properties by themselves.

Later, a generic command/function can be developed ... so users can save/restore all properties of named objects with just one line of code.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: DOM selection

Postby Neosoft Support » Fri Feb 06, 2015 10:47 am

Will there be event sections in NeoAppBuilder for "Page Enter" and "Page Exit" ... like we have with NeoBook ?


Clicking on the page background (not on an object) will select the page. When the page is selected, the code editor will show events for page enter and page exit.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: DOM selection

Postby Gaev » Fri Feb 06, 2015 2:04 pm

Dave:

Clicking on the page background (not on an object) will select the page. When the page is selected, the code editor will show events for page enter and page exit.

Sorry, I was a bit quick on the draw ... should have checked before posting.

However, please see my posting at http://www.neosoftware.com/webissues/client/index.php?issue=18 ... where I observed ...
@Dave: When I "Run in Firefox" ... and then return to Design Mode ... the entered code for this event section does not display any more ... but if I navigate to another page ... and return to it, all is well !!!
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: DOM selection

Postby Neosoft Support » Sat Feb 07, 2015 11:05 am

@Dave: When I "Run in Firefox" ... and then return to Design Mode ... the entered code for this event section does not display any more ... but if I navigate to another page ... and return to it, all is well !!!


The code in the page enter action disappears? Make sure the page is still selected. It may be that when you return from FireFox you're clicking on the background and un-selecting the page.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: DOM selection

Postby Gaev » Sat Feb 07, 2015 12:07 pm

Dave:

Make sure the page is still selected. It may be that when you return from FireFox you're clicking on the background and un-selecting the page.

That was it ... I thought that clicking on the background would ALWAYS select the Page object ... but from the handle bars/circles, it looks like this selection is toggled on/off with each click.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 1 guest