Sigma Php Ajax framework, Ajax Components, GUI Builder
May 24, 2012, 10:47:03 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Sigma Php Ajax framework, Ajax Components, GUI Builder
>
Sigma Visual GUI Builder & Library
>
Sigma Visual - Q&A
(Moderators:
steven
,
linb
) >
linb4 and treegrid setrows
Pages: [
1
]
« previous
next »
Print
Author
Topic: linb4 and treegrid setrows (Read 687 times)
sedrok (jslinb.ru)
Sr. Member
Posts: 57
linb4 and treegrid setrows
«
on:
November 14, 2011, 03:40:00 AM »
im using linb4 from svn 1368:
if i add this data into treegrid using UIBuilder - i will get one row in treegrid.
[{ "cells" : [{ "value" : 1 }, { "value" : 2 }, { "value" : 3 }, { "value" : "" }], "id" : "d" }] [code] but if i recieve rsp data from ajax request and set to grid it is not appear [code] linb.request("curdata.php", {}, function(rsp){ var rspobj = rsp; linb.log(rsp); if(rspobj){ this.ctl_treegrid2.setRows(rspobj); }else{ linb.log('1'); } }, function(rsp){ linb.log('2'); }, null, null);
curdata.php:
echo "[{ id : 'row_1', cells : ['cell_1','1','true','label1','rer','3434'] }]";
rows don't appear, why?
// 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(70) .setCaption("click me") .onClick("_ctl_sbutton1_onclick") ); append( (new linb.UI.TreeGrid) .setHost(host,"ctl_treegrid2") .setDock("none") .setLeft(250) .setTop(100) .setWidth(530) .setRowNumbered(true) .setHeader([{"id":"col1", "width":80, "type":"label", "caption":"col1"}, {"id":"col2", "width":80, "type":"label", "caption":"col2"}, {"id":"col3", "width":80, "type":"label", "caption":"col3"}, {"id":"col4", "width":80, "type":"label", "caption":"col4"}]) .setRows([{"cells":[{"value":1, "id":"c_a", "oValue":1}, {"value":2, "id":"c_b", "oValue":2}, {"value":3, "id":"c_c", "oValue":3}, {"value":"13", "id":"c_d", "oValue":"13"}], "id":"d"}]) .onGetContent("_ctl_treegrid2_ongetcontent") ); 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) { linb.request("curdata.php", {}, function(rsp){ var rspobj = rsp; linb.log(rsp); if(rspobj){ this.ctl_treegrid2.setRows(rspobj); }else{ linb.log('1'); } }, function(rsp){ linb.log('12'); }, null, null); }, _ctl_treegrid2_ongetcontent : function(profile,row,callback){ var ns = this, uictrl = profile.boxing(); } } });
[/code][/code]
Logged
linb
Administrator
Hero Member
Posts: 435
Re: linb4 and treegrid setrows
«
Reply #1 on:
November 14, 2011, 05:08:12 PM »
Monitor your server's response, maybe the return data is text format or something
var rspobj = _.unserialize(rsp);
Logged
sedrok (jslinb.ru)
Sr. Member
Posts: 57
Re: linb4 and treegrid setrows
«
Reply #2 on:
November 14, 2011, 11:00:21 PM »
// 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(70) .setCaption("click me") .onClick("_ctl_sbutton1_onclick") ); append( (new linb.UI.TreeGrid) .setHost(host,"ctl_treegrid2") .setDock("none") .setLeft(130) .setTop(190) .setWidth(620) .setRowNumbered(true) .setHeader([{"id":"col1", "width":80, "type":"label", "caption":"col1"}, {"id":"col2", "width":80, "type":"label", "caption":"col2"}, {"id":"col3", "width":80, "type":"label", "caption":"col3"}, {"id":"col4", "width":80, "type":"label", "caption":"col4"}]) ); 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 : {"onReady":"_com_onready"}, _ctl_sbutton1_onclick : function (profile, e, src, value) { linb.request("curdata.php", {}, function(rsp){ linb.log(rsp); SPR.ctl_treegrid2.setRows(_.unserialize(rsp)); }, function(rsp){ linb.log('error'); }, null, null); }, _com_onready : function(com,threadid){ window.SPR = this; } } });
don't work ,
why?
curdata.php :
echo "[{ id : 'row_1', cells : ['cell_1','1','true','label1','rer','3434'] }]";
Logged
sedrok (jslinb.ru)
Sr. Member
Posts: 57
Re: linb4 and treegrid setrows
«
Reply #3 on:
November 17, 2011, 10:12:51 AM »
http://www.linb.net/VisualJS/projects/SPA_4311781984/
Logged
linb
Administrator
Hero Member
Posts: 435
Re: linb4 and treegrid setrows
«
Reply #4 on:
November 17, 2011, 04:22:57 PM »
It works now, check it out please!
Logged
sedrok (jslinb.ru)
Sr. Member
Posts: 57
Re: linb4 and treegrid setrows
«
Reply #5 on:
November 18, 2011, 01:49:06 AM »
_.unserrialize not work but rsp work yes?
SPR.ctl_treegrid2.setRows(rsp);
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News & Announcements
-----------------------------
Sigma Visual GUI Builder & Library
-----------------------------
=> Sigma Visual - Knowledge Share
=> Sigma Visual - Q&A
=> Bug Report & Wishlist
-----------------------------
Sigma Grid
-----------------------------
=> Sigma Grid - Q&A
=> Show Case
=> Bug Report & Wishlist
-----------------------------
Other
-----------------------------
=> AJAX & JavaScript
Loading...