[ 2 posts ]

Ilya Goberman

  • Username: igoberman
  • Joined: Wed Aug 17, 2011 2:11 pm
  • Posts: 66
  • Offline
  • Profile

editorCancelEvent and editorSaveEvent invoked incorrectly

Post Posted: Wed Aug 17, 2011 2:22 pm
+0-
Hello,
I have found what I think is a bug in YUI 2 YAHOO.widget.DataTable.
I have a table that allows column reordering. I also have column editors. I register for the editorCancelEvent and editorSaveEvent event listeners to detect save and cancel editor.
It works fine till I reorder columns. One I do that the listeners are fired one additional time for every reorder. So if I reorder columns 3 times, the event is fired 4 times instead of one.
I have spent several hours so far trying to find a workaround with no luck. It is very important to find some solution to this. Any help is greatly appreciated.
Thanks

Ilya Goberman

  • Username: igoberman
  • Joined: Wed Aug 17, 2011 2:11 pm
  • Posts: 66
  • Offline
  • Profile

Re: editorCancelEvent and editorSaveEvent invoked incorrectl

Post Posted: Thu Aug 18, 2011 6:07 am
+0-
I also found out that problem appears when I add or remove columns. This is a test:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Inline Cell Editing</title>

<style type="text/css">
/*margin and padding on body element
can introduce errors in determining
element position and are not recommended;
we turn them off as a foundation for YUI
CSS treatments. */
body {
margin:0;
padding:0;
}
</style>

<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/calendar/assets/skins/sam/calendar.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/datatable/assets/skins/sam/datatable.css" />

<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/yahoo/yahoo-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/event/event-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/dom/dom-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/container/container-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/utilities/utilities.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/element/element-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/datasource/datasource-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/event-delegate/event-delegate-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/datatable/datatable-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/menu/menu-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/resize/resize-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/layout/layout-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.9.0/build/animation/animation-min.js"></script>


<!--begin custom header content for this example-->
<style type="text/css">
/* custom styles for this example */
.yui-skin-sam .yui-dt-col-address pre { font-family:arial;font-size:100%; } /* Use PRE in first col to preserve linebreaks*/
</style>

<!--end custom header content for this example-->

</head>

<body class="yui-skin-sam">


<div id="cellediting"></div>

<script type="text/javascript" src="assets/js/data.js"></script>
<script type="text/javascript">
YAHOO.util.Event.addListener(window, "load", function () {
YAHOO.example.InlineCellEditing = function () {

var myColumnDefs = [
{ key: "city", editor: new YAHOO.widget.TextareaCellEditor(), resizeable: true, width: 100 },
{ key: "state", resizeable: true, width: 100 }
];

var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.addresses);
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = {
fields: ["city", "state"]
};

var myDataTable = new YAHOO.widget.DataTable("cellediting", myColumnDefs, myDataSource, { scrollable: true, draggableColumns: true });

myDataTable.subscribe("cellClickEvent", function (oArgs) {
myDataTable.onEventShowCellEditor(oArgs);
});

myDataTable.subscribe("editorCancelEvent", function (oArgs) {
alert('editorCancelEvent')
});

return {
oDS: myDataSource,
oDT: myDataTable
};
} ();
});
</script>
</body>
</html>
  [ 2 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