[ 7 posts ]

Ilya Goberman

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

Combo Loader dependency loading sequence issue.

Post Posted: Fri May 18, 2012 9:53 am
+0-
Hello,
I am having issue with Combo Loader dependency loading for YUI2.

I use YUI2 Data Table in my module ('yui2-datatable'). I need to enable column reordering and therefore I have to also use 'yui2-dragdrop' also. The problem is that combo loader is loading 'dragdrop' after the 'datatable'. This results in constructor for YAHOO.widget.DataTable generating exception.
This is very frustrating problem and I have been looking for a while for a workaround. How can I enforce the load order? I am looking for any other workaround.
Thanks

This is what I have:
YUI.add('my-data-table-control', function (Y) {
}, '1.0.0', { loadOptional : true, requires: ['yui2-dragdrop', 'yui2-datatable'] });

Ilya Goberman

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

Re: Combo Loader dependency loading sequence issue.

Post Posted: Fri May 18, 2012 10:29 am
+0-
Interestingly, if I move 'requires' to the configuration, it starts working, but it is ugly workaround I do not understand:

YUI.add('my-data-table-control', function (Y) {
}, '1.0.0'/*, { requires: ['yui2-dragdrop', 'yui2-datatable'] }*/);


var config = {
modules: {
'my-data-table-control': {
fullpath: myPath,
// THIS SHOULD NOT BE HERE!
requires: ['yui2-dragdrop', 'yui2-datatable']
}
}
};

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: Combo Loader dependency loading sequence issue.

Post Posted: Fri May 18, 2012 12:42 pm
+0-
What version of YUI are you using?

Ilya Goberman

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

Re: Combo Loader dependency loading sequence issue.

Post Posted: Fri May 18, 2012 1:01 pm
+0-
Tried with 3.5.0, 3.5.1, and 3.6.0pr1 - same issue. Looks like a bug to me.
I have now reverted to listing dependencies in YUI(arg).use(...) argument, not in module 'requires'.

One other issue I experienced is that with YUI(arg).use(...) and "combine: true, maxURLLength: 2048" in the 'arg' I have one single request going to the server, but once I move dependencies to my modules, I end up with multiple requests generated by YUI to my combo server, that is not desirable for me.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile
Tags:

Re: Combo Loader dependency loading sequence issue.

Post Posted: Fri May 18, 2012 1:22 pm
+0-
Please file an ticket for the requires issue. It should work as you expect and I have several tests to verify that my use cases are passing.

As for the single request, you are using it correctly. If you want a longer URL length for the combo you must use the `maxURLLength` config (that's what it's there for).

Ilya Goberman

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

Re: Combo Loader dependency loading sequence issue.

Post Posted: Sat May 19, 2012 6:47 am
+0-
Dav,
I was able to duplicate it in a very simple test. I will file a bug next week, unless you want to take a quick look:
HTML:
<!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>Loader test</title>

<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/datatable/assets/skins/sam/datatable.css" />
<script type="text/javascript" src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
</head>

<body class="yui-skin-sam">
<div id="basic"></div>
</body>
<script type="text/javascript">
var config = {
modules: {
'my-module': {
async: false,
fullpath: 'loaderTestModule.js'
}
}
};
YUI(config).use('my-module', function (Y) {
new Y.MyModule();
});
</script>

MODULE:

YUI.add('my-module', function (Y) {
Y.MyModule = function () {
var myColumnDefs = [
{ key: "id", sortable: true, resizeable: true },
{ key: "quantity", sortable: true, resizeable: true }
];

var myDataSource = new Y.YUI2.util.DataSource([ { id: "po-0167", quantity: 1 } ]);
myDataSource.responseType = Y.YUI2.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = { fields: ["id", "quantity"] };

var myDataTable = new Y.YUI2.widget.DataTable("basic", myColumnDefs, myDataSource, { caption: "DataTable Caption", scrollable: true, draggableColumns: true });
};
}, '1.0.0', { requires: ['yui2-dragdrop', 'yui2-datatable'] });

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Combo Loader dependency loading sequence issue.

Post Posted: Mon May 21, 2012 8:57 am
+0-
Ticket Created: http://yuilibrary.com/projects/yui3/ticket/2532344
  [ 7 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