Increased a date with 1 month

Develop and Deploy Cross-Browser Web Apps .

Increased a date with 1 month

Postby wahono77 » Fri Jun 14, 2013 8:27 am

javascript code
// The default code is a com class (inherited from xui.Com)
Class('App', 'xui.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 CrossUI RAD Tools
var host=this, children=[], append=function(child){children.push(child.get(0))};

append(
(new xui.UI.TreeGrid)
.setHost(host,"ctl_treegrid21")
.setShowDirtyMark(false)
.setDock("width")
.setDockMargin({"left":10, "top":0, "right":10, "bottom":0})
.setTop(10)
.setHeight(290)
.setBottom(10)
.setSelectable(true)
.setAltRowsBg(true)
.setRowNumbered(true)
.setEditable(true)
.setHeaderHeight(24)
.setRowHeight(24)
.setRowResizer(true)
.setHeader([{"id":"name", "type":"input", "width":200, "caption":"Petugas"}, {"id":"kind", "type":"combobox", "width":200, "caption":"Metode", "editorListItems":[{"id":"email", "caption":"Email"}, {"id":"call", "caption":"Telepon"}, {"id":"direct", "caption":"Langsung"}]}, {"id":"notes", "type":"textarea", "width":300, "caption":"Catatan", "cellStyle":"multiline:true"}, {"id":"date", "type":"datetime", "width":150, "caption":"Tanggal"}])
.setRows([{"cells":[{"value":"This sentence should be wrapped in next line", "id":"c_a"}, {"value":"column 2", "id":"c_b"}, {"value":"column 3", "id":"c_c"}, {"value":new Date(2014,0,13,14,57,37,0), "id":"c_d"}], "id":"m"}])
.setTreeMode(false)
.onRender("_ctl_treegrid21_onrender")
);

return children;
// ]]Code created by CrossUI RAD Tools
},
// 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_treegrid21_onrender : function (profile){
var ns = this, uictrl = profile.boxing();
uictrl.autoRowHeight();
}
},
Static : {
viewSize : {"width":800, "height":600}
}
});


My question, why new Date(2014,0,13,14,57,37,0) give result 2014-01-13 14:57, it is increased 1 month I think.
Is this problem from XUI or browser?

Thanks
wahono77
 
Posts: 90
Joined: Sat Apr 13, 2013 6:04 am

Re: Increased a date with 1 month

Postby wahono77 » Fri Jun 14, 2013 8:28 am

Another question, how to wrapping text line like in first column above?
Thanks
wahono77
 
Posts: 90
Joined: Sat Apr 13, 2013 6:04 am

Re: Increased a date with 1 month

Postby support » Fri Jun 14, 2013 10:58 am

1. In javascript, month start from zero.
2. word_wrap :

   
// The default code is a com class (inherited from xui.Com)
Class('App', 'xui.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 CrossUI RAD Tools
var host=this, children=[], append=function(child){children.push(child.get(0))};

append(
(new xui.UI.TreeGrid)
.setHost(host,"ctl_treegrid21")
.setShowDirtyMark(false)
.setDock("width")
.setDockMargin({"left":10, "top":0, "right":10, "bottom":0})
.setTop(10)
.setHeight(290)
.setBottom(10)
.setSelectable(true)
.setAltRowsBg(true)
.setRowNumbered(true)
.setEditable(true)
.setHeaderHeight(24)
.setRowHeight(24)
.setRowResizer(true)
.setHeader([{"id":"name", "type":"input", "width":200, "caption":"Petugas", cellClass:"word_wrap"}, {"id":"kind", "type":"combobox", "width":200, "caption":"Metode", "editorListItems":[{"id":"email", "caption":"Email"}, {"id":"call", "caption":"Telepon"}, {"id":"direct", "caption":"Langsung"}]}, {"id":"notes", "type":"textarea", "width":300, "caption":"Catatan", "cellStyle":"multiline:true"}, {"id":"date", "type":"datetime", "width":150, "caption":"Tanggal"}])
.setRows([{"cells":[{"value":"This sentence should be wrapped in next line", "id":"c_a"}, {"value":"column 2", "id":"c_b"}, {"value":"column 3", "id":"c_c"}, {"value":new Date(2014,0,13,14,57,37,0), "id":"c_d"}], "id":"m"}])
.setTreeMode(false)
.onRender("_ctl_treegrid21_onrender")
);

return children;
// ]]Code created by CrossUI RAD Tools
},
// 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_treegrid21_onrender : function (profile){
var ns = this, uictrl = profile.boxing();
uictrl.autoRowHeight();
},
_com_onready : function (com, threadid){
xui.CSS.addStyleSheet(".word_wrap{"+
"white-space: pre-wrap; /* css-3 */"+
"white-space: -moz-pre-wrap; /* Mozilla, since 1999 */"+
"white-space: -pre-wrap; /* Opera 4-6 */"+
"white-space: -o-pre-wrap; /* Opera 7 */"+
"word-wrap: break-word; /* Internet Explorer 5.5+ */"+
"}", "__tag")
}
},
Static : {
viewSize : {"width":800, "height":600}
}
});
   
support
 
Posts: 352
Joined: Sat Apr 27, 2013 9:22 am

Re: Increased a date with 1 month

Postby wahono77 » Fri Jun 14, 2013 6:51 pm

Thanks for your support, it very help me.

BTW, I make request, in the next version CrossUI add new property "WordWrap". :D
wahono77
 
Posts: 90
Joined: Sat Apr 13, 2013 6:04 am

Re: Increased a date with 1 month

Postby support » Sat Jun 15, 2013 9:50 am

   
Class('App', 'xui.Com',{
Instance:{
iniComponents : function(){
// [[Code created by CrossUI RAD Tools
var host=this, children=[], append=function(child){children.push(child.get(0))};
append(
(new xui.UI.TreeGrid)
.setHost(host,"ctl_treegrid21")
.setShowDirtyMark(false)
.setDock("none")
.setDockMargin({"left":10, "top":0, "right":10, "bottom":0})
.setLeft(80)
.setTop(20)
.setWidth(430)
.setHeight(290)
.setBottom(10)
.setSelectable(true)
.setAltRowsBg(true)
.setEditable(true)
.setRowHandler(false)
.setRowResizer(true)
.setHeader([{"id":"name", "type":"input", "width":200, "caption":" input input input input input input input", "headerClass":"xui-cls-wordwrap", "cellClass":"xui-cls-wordwrap"}, {"id":"name2", "width":200, "type":"textarea", "caption":"textarea"}])
.setRows([["This sentence should be wrapped in next line","This sentence should be wrapped in next line"],["This sentence should be wrapped in next line","This sentence should be wrapped in next line"]])
.setTreeMode(false)
.onRender("_ctl_treegrid21_onrender")
);

return children;
// ]]Code created by CrossUI RAD Tools
},
_ctl_treegrid21_onrender : function (profile){
var ns = this, uictrl = profile.boxing();
uictrl.autoColHeight().autoRowHeight();
}
}
});
   
support
 
Posts: 352
Joined: Sat Apr 27, 2013 9:22 am


Return to CrossUI for Web Apps

Who is online

Users browsing this forum: No registered users and 0 guests

cron