Real Software Forums

Page 1 of 1

Author:  simulanics [ Wed Jan 09, 2013 11:00 pm ]
Post subject:  jQueryProgressBar I've managed to get 6 more jQuery controls completed and 99% of this one:

jQuery ProgressBar: ... essbar.rbo

I believe my error lies in the constructor again as I'm receiving the:

Unexpected Token {


Any help would be greatly appreciated and I'll be posting the 8 so-far converted controls on RSDS later tomorrow with the new update of the Library as well :-)

Const kConstructor:
{$("#<<controlid>>").progressbar({value: <<options>>});

Sub MakeConstructor
Dim js As String = kConstructor

js = Replace(js, "<<options>>", str(Value))
js = js.ReplaceAll("<<controlid>>", Self.ControlID)

Dim source() As String
source.Append("RSCustom.RSDS.jQuery.progressbar." + Self.ControlID + "_constructor = function(n) {")
source.Append("RS.triggerServerEvent('" + Me.ControlID + "','LibrariesLoaded');")
source.append js
Return Join(source, EndOfLine.UNIX)

Property Value as Integer

mValue = value
ExecuteJavaScript("$('#" + Me.ControlID + "').progressbar({ value: " + str(value) + "});")
End Set

Author:  Stretch [ Wed Jan 09, 2013 11:53 pm ]
Post subject:  Re: jQueryProgressBar

Your constructor has a subtle bug:

{$("#<<controlid>>").progressbar({value: <<options>>});

Your Function statement is missing a close bracket and a close curly brace. For clarity, I usually write these like this, just so you don't miss anything:

$(document).ready(function() {
$("#<<controlid>>").progressbar({value: <<options>>});

Author:  simulanics [ Thu Jan 10, 2013 9:15 am ]
Post subject:  Re: jQueryProgressBar

Foolish me :-(...I'll start using a javascript syntax checker (will include a feed back for this as well as it would be a great addition for WebControlWrapper), although now I'm having the following error

Could not execute returned javascript: $ is not defined
Source: var langdir = document.getElementsByTagName('body')[0]; if(langdir) { langdir.removeAttribute('dir'); }
var langdir = document.getElementsByTagName('body')[0]; if(langdir) { langdir.setAttribute('lang','en-US,en;q=0.8'); }

THE FIX (for those who may encounter this error):

In the computed property I forgot to check that the Libraries have been loaded first....upon creation of the control, the set event of the property is invoked...the libraries MUST be loaded before set can be invoked my property should look like the following:

mValue = value
if LibrariesLoaded = true then
ExecuteJavaScript("$('#" + Me.ControlID + "').progressbar({ value: " + str(value) + "});")
end if


Would it be possible to invoke computed properties after the generation of controls?...still invoking non-computed properties before libraries have been loaded within the WebControlWrapper class? I realize this would mean a change within the WebSDK...but before I make a feedback I just want to make sure that I myself, am not doing something incorrectly. Yet it would be understood that within the WebControlWrapper that computed properties would always (in probably 90% of the time) involve some sort of javascript...which would need to be invoked after control creation rather than before?...I realize this should probably be within the beta list, although may be valuable to another community member since the WebSDK has already been released and I'd like to prevent the cascade of similar questions since someone else may search for a similar question. (Thus, why my posts are generally 'long' to ensure I include as many keywords which may be searched related to similar questions :-))

Author:  Stretch [ Thu Jan 10, 2013 10:55 am ]
Post subject:  Re: jQueryProgressBar

No. That's basic underpinnings of the framework and would break everything else.

Here's what I'd suggest: Make an array of commands to defer until after the libraries have loaded and then if they haven't loaded yet, stick them in there. Once they do load, execute that batch right away.

Author:  simulanics [ Thu Jan 10, 2013 1:24 pm ]
Post subject:  Re: jQueryProgressBar

Everything is coming along good so far..thanks Greg

working demo (I applied an animated background to the demo using property list) :-)

Author:  Stretch [ Thu Jan 10, 2013 2:16 pm ]
Post subject:  Re: jQueryProgressBar

Something to note. You notice that when the page initially draws the controls are unstyled and off to the top/left? It might be worth waiting until the Shown event to set the visibility of the controls to "visible". You can do that later using javascript:

ExecuteJavascript("RS.get('" + self.controlid + "').style.visibility = 'visible';")

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group