[ 4 posts ]

bible

  • Username: DazzlingBeing
  • Joined: Sun Jun 24, 2012 8:35 pm
  • Posts: 6
  • Offline
  • Profile

Why can not set value to Y.DataTable when upgrade YUI 3.6.0?

Post Posted: Tue Aug 21, 2012 6:19 pm
+0-
After retrieve data and use Y.DataTable.addRow to add data, then I use DataTable's model to set value, this dose not effect on the web page. This is appeared when I upgrade YUI to 3.6.0.

Example: table is a instant of Y.DataTable
table.addRow(....); //then the page coule display the table's data
table.data.item(0).set("no", 1); //the page coule not display 1 at first row with column 'no'
alert(table.data.item(0).get("no")); //the model is do set to 1

So what's the problem above when upgrade YUI to 3.6.0, this is correct when use YUI 3.5.1

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile
Tags:

Re: Why can not set value to Y.DataTable when upgrade YUI 3.

Post Posted: Tue Aug 21, 2012 7:24 pm
+0-
Not quite sure what you are trying, can you post a code sample to demonstrate this?

This works, http://jsfiddle.net/blunderalong/ZnSVE/ using either .addRow() or .data.add() and .modifyRow() and .data.set() for both 3.5.0 and 3.6.0.

bible

  • Username: DazzlingBeing
  • Joined: Sun Jun 24, 2012 8:35 pm
  • Posts: 6
  • Offline
  • Profile

Re: Why can not set value to Y.DataTable when upgrade YUI 3.

Post Posted: Wed Aug 22, 2012 7:37 pm
+0-
I found the problem occurred by DataTable's recordType attribute:
YUI().use( "datatable", "cssfonts", function(Y){
Y.one("body").addClass("yui3-skin-sam");
var some_data =[
{no:0, fname:'jesse', status:1},
{no:0, fname:'gustavo', status:0},
{no:0, fname:'walter', status:1},
{no:0, fname:'hank', status:1},
{no:0, fname:'tuco', status:0}
];
var dtable = new Y.DataTable({
columns: ['no','fname','status'],
data: some_data
}).render('#divTable');
//notice this sentense
dtable.set("recordType", dtable.get("columns"));

Y.one("#btnChange").on("click",function(){
var modelList = this.data;
for (var i = 0; i < modelList.size(); i++) {
modelList.item(i).set("no", i);
}
},dtable);
});
So when you click the button, the column 'no' value has no changed.
This is happend when set the recordType, using datatable's Model.set or setAttrs had no effect, if omitted, then could set value by using Model.set.(Only YUI 3.6 occurd this problem)

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile
Tags:

Re: Why can not set value to Y.DataTable when upgrade YUI 3.

Post Posted: Wed Aug 22, 2012 7:49 pm
+0-
I have absolutely no idea what you are trying to accomplish :-(

If this works for you, great!
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum