Focal Point
[Closed] Control Property

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7157064476

January 27, 2015, 10:17 AM
MattC
[Closed] Control Property
Not sure if I can do this, but I have a tree control that I want to change one of the properties via JS.


selectallchildren="yes"  



Based on an "OnChange" event, I want to either set this to yes or no. I know I can get other properties like TOP and LEFT, but I question if I can get this particular one and be able to set it.

This message has been edited. Last edited by: MattC,


WebFOCUS 8.1.05
January 28, 2015, 04:34 AM
Tony A
Matt,

Are you using plain JS or jQuery? Either way how are you accessing the other attributes as it will give me an idea on how best to advise you using a method that you already may know.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 28, 2015, 07:23 AM
MattC
Thanks Tony for the response. I started working on alternate solution, by adding in additional Tree control and toggling on/off based on selection, but I would prefer not to do it this way if I can control the property.

I am just using plain JS. For example, here is a panel that I am adjusting position for

 var FiltPanl  =    window.document.getElementById("Filter_Panel");

 


Based on an IF condition

       FiltPanl.style.top = "1870px" ;
  


I am not really sure how to access these other properties.


WebFOCUS 8.1.05
January 28, 2015, 07:42 AM
Tony A
Hi Matt,

Ok, you are accessing the top attribute using .style and plain JS. If you are happy to go with jQuery then you may be able to access the other attributes using something like the snippet below. As you are on 8.0.08 the jQuery libraries will be included in your composer file.

$("Filter_Panel").attr("selectallchildren","yes");

However, I've not played with the tree control in this way so couldn't state that this will work or not.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 28, 2015, 08:26 AM
MattC
I have not really used jQuery before. My HTML was built in 7 so I don't see any references to the libraries. I tried to add them but my page just blows up.

By chance would you happen to have an example of how to reference the libraries?


WebFOCUS 8.1.05
January 28, 2015, 09:20 AM
Tony A
If you have your HTML built from 7 then you need to be very careful (as Francis will no doubt attest!). I also assumed (perhaps wrongly) use of App Studio over Dev Studio Frowner

I did post a code sample a short while ago that allowed you to pull the jQuery libraries direct from your embedded JS (DS 8.n doesn't load jQuery by default) and this code may work for you without having to open your code in edit? Can't locate it at present though Frowner

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 28, 2015, 09:43 AM
MattC
Thanks Tony.

Sorry, I am using DS 8. I try and stay out of edit mode, if all possible. I can understand why Francis would attest.

I have done the calls in an HTML form as I see examples from Dave Briars, but putting in the calls in this HTML really messes things up.

I'll poke around and see if I can find your example, if not I will proceed with my alternate solution.


WebFOCUS 8.1.05
January 28, 2015, 10:24 AM
Francis Mariani
Based on my experiences so far, I'd wait for WebFOCUS 9 Frowner


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 29, 2015, 08:06 AM
MattC
I gave up on this. I ended up modifying my design. I did find a way to call the jQuery libraries, but I couldn't get it to work with the Tree Control.


WebFOCUS 8.1.05
January 30, 2015, 03:40 AM
Tony A
quote:
I did post a code sample a short while ago that allowed you to pull the jQuery libraries direct from your embedded JS

Apologies, I was otherwise occupied yesterday, but I still haven't been able to locate the code that I thought (am fairly sure?) that I posted. So just in case, I'll post it here. You never know, it may help someone else looking at the thread in future.

Just drop this code into the "Embedded Javascript" within HTML Composer and it will add the jQuery library within the "Head" section of your HTML file on loading. You will then have access to the jQuery library straight away.

Don't forget that you would not require this within HTML Composer using App Studio.

This code adds a jQuery document ready function to prove that it works and is only for demonstration purposes.

//Begin function window_onload
function window_onload() {
 
loadjQuery();
 
UpdateData();
 
$(document).ready(function() {
  alert("Hello World");
});
 
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
 
function loadjQuery() {
  var element = document.createElement('script');
  element.async = false;
  element.src = '/ibi_apps/ibi_html/javaassist/jquery/jquery_min.js';
  element.type = 'text/javascript';
  (document.getElementsByTagName('head')[0]||document.body).appendChild(element);
}

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 30, 2015, 09:38 AM
MattC
Thanks Tony,

I found that function except for calling Google's libraries.

I just don't think it works for a Tree Control. Tree Controls are a beast.

I had a requirement to provide basically the same tree control, but based on selection they wanted to toggle off the selecting all children. I ended up adding an additional tree control and just toggling the show/hide.

This particular HTML I am working on is a beast itself. Makes me nervous when I have to go under the covers to add something. I am always fearful that any slight change will break something.


WebFOCUS 8.1.05
January 30, 2015, 10:39 AM
Francis Mariani
element.src = '/ibi_apps/ibi_html/javaassist/jquery/jquery_min.js';
I wonder which version of jQuery is loaded with this command.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
January 30, 2015, 11:16 AM
MattC
This may be a dumb question, but does version matter? I would kind of think it would in some respect, but maybe not.


WebFOCUS 8.1.05
January 30, 2015, 11:46 AM
Tony A
quote:
which version of jQuery is loaded

Francis,

I'm sure that your question was rhetorical and I'm not quite sure of the reason for you posing it - although I can guess Wink

Just for other members, because you know already, the version will be one that was installed (if any) with your version of WF8 (unless your site has overwritten it of course) but the URL could easily be the path reference to the version that you want.

You'll probably now ask why did I code for one installed with WF? The answer is that some installations are not exposed to the internet and would therefore be unable to reference one outside of their installation. But then you knew that!

For Matt,

Not a dumb question at all! I think that Francis is just trying to imply that the version shipped with WF is an older version and not the latest with extra functionality, but then he would realise that you have to ship with a version. Personally I would use one that provided the functionality needed for the task in hand. It is nice sometimes to use some of the latest functionality, but for simple control disabling, value changing, combo list manipulation etc. why do I need to put the latest version in when a basic version will suffice?

I wouldn't put a 4.2 litre Jaguar V12 engine in a Ford model T because I wouldn't be able to utilise everything that the V12 could give Smiler


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 30, 2015, 11:53 AM
Tony A
quote:
I wouldn't put a 4.2 litre Jaguar V12 engine in a Ford model T

Although I would have to admit that it would be fun to do so Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 30, 2015, 12:06 PM
MattC
Thanks again. That's what I kind of thought, but wasn't for sure.


WebFOCUS 8.1.05