Sigma Php Ajax framework, Ajax Components, GUI Builder
May 21, 2012, 11:19:07 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Possible bug in jsLinb4.0  (Read 1152 times)
Anthony
Full Member
***
Posts: 24


View Profile
« on: June 25, 2011, 01:50:22 AM »

Hi everyone

I recently downloaded the latest svn jsLinb4.0.

I tested the following code on jsLinb3.0 and that works fine, (Note the backend is a simple html file), but version 4 only returns false.

Is this a bug or am I missing something?

I am pretty new to this so it maybe me.

Many Thanks

Anthony

// The default code is a com class (inherited from linb.Com)
Class('App', 'linb.Com',{
    // Ensure that all the value of "key/value pair" does not refer to external variables
    Instance:{
        // To initialize instance(e.g. properties)
        initialize : function(){
            // To determine whether or not the com will be destroyed, when the first UI control be destroyed
            this.autoDestroy = true;
            // To initialize properties
            this.properties = {};
        },
        // To initialize internal components (mostly UI controls)
        // *** If you're not a skilled, dont modify this function manually ***
        iniComponents : function(){
            // [[code created by jsLinb UI Builder
            var host=this, children=[], append=function(child){children.push(child.get(0))};
           
            append(
                (new linb.UI.SButton)
                .setHost(host,"ctl_sbutton1")
                .setLeft(130)
                .setTop(240)
                .setCaption("click me")
                .onClick("_ctl_sbutton1_onclick")
            );
           
            append(
                (new linb.UI.Dialog)
                .setHost(host,"ctl_dialog1")
                .setLeft(410)
                .setTop(140)
                .setCaption("ctl_dialog1")
            );
           
            return children;
            // ]]code created by jsLinb UI Builder
        },
        // Give a chance to load other com
        iniExComs : function(com, threadid){
        },
        // Give a chance to determine which UI controls will be appended to parent container
        customAppend : function(parent, subId, left, top){
            // "return false" will cause all the internal UI controls will be added to the parent panel
            return false;
        },
        // This instance's events
        events : {},
        _ctl_sbutton1_onclick : function (profile, e, src, value) {
            var uictrl = profile.boxing();
            var me = this;
            var params = {name:34, rnd:Math.random() * 1000}
           
            linb.request("http://localhost/web_tcmcare/hello.html",
                         params,
                         function (rsp){
                             me.ctl_dialog1.setHtml(rsp);
                         },
                         function(rsp){
                             linb.alert("Error");
                         },null,null);
        }
    }
});
Logged
linb
Administrator
Hero Member
*****
Posts: 435


View Profile
« Reply #1 on: June 25, 2011, 06:28:24 AM »

Your code is to get a static html file content, maybe you can learn AJAX first.


To get a static html text:
 
linb.request("http://localhost/web_tcmcare/hello.html",
                         {},
                         function (rsp){
                             alert(rsp);
                         },
                         function(rsp){
                             linb.alert("Error");
                         },
                         null,
                         {proxyType:'Ajax',rspType:'text'});
Logged
Anthony
Full Member
***
Posts: 24


View Profile
« Reply #2 on: June 27, 2011, 02:53:04 AM »

Thanks for that

However pls note the following

1/ The code I gave was from the tutorial
http://sigmawidgets.com/forum/knowledge-share/tutorial-2-make-a-asynchronous-calling/
 
which works for version 3.0 but not version 4.0

2/ I decided to knock up a traditional ajax to retrieve data from an mysql db that worked fine
i then knock up an equivalent using linb version 3.0 That worked fine, return data was json format.

However i put the same code through version 4.0 and still it did not work ie it returned false.

I am sure it must be me, but I cannot see why it should work for version 3 and not version 4.

pls help

Anthony


Logged
linb
Administrator
Hero Member
*****
Posts: 435


View Profile
« Reply #3 on: June 27, 2011, 07:11:38 PM »

OK. I enhanced this function in 4.0.

Update the latest code from our snv(http://linb.googlecode.com/svn/trunk/jsLinb4.0) please.
Logged
Anthony
Full Member
***
Posts: 24


View Profile
« Reply #4 on: June 28, 2011, 04:48:39 AM »

It works Smiley

Many thanks

Anthony
Logged
linb
Administrator
Hero Member
*****
Posts: 435


View Profile
« Reply #5 on: January 16, 2012, 05:11:52 PM »

version 3 and not version 4 are not compitable with Ajax return format.

You can monitor the ajax result with FireBug, to see the data format is 'text' or 'json object'.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!