I am struggling to manage my code using needJS and appreciate any help.
I have a list of panels in Dashboard.html Dashboard ViewDodal which is connected to the 'Dashboard' ViewLog in Dashboard-init.js, which is the dashboard. Html is shown as a list.
After the render completes, I call the grid-list function to convert the list to a dashboard.
Please note that this works correctly if I include these scripts in html using the script = ... etc.
But when I removed the script tag and pushed these dependencies to the dashboard view mODEL, I get this error:
Unwanted error: Unable to bind operation What do I need to do to satisfy the grid-list ob requirement?
P>
Here is the page that this Error (Dashboard. Html):
gt; Top & gt; & lt; link rel = "stylesheet" href = "css / style. Css "/> gt; & lt; body & gt; div class =" grid-container "& gt; & lt; ul id =" grid "class =" grid "data -bind = "foreach: {Data: After Panels, Reader: Posterender}" & gt; & lt; li ... "& gt; ... & lt; / Ul & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; Script src = "script / require.js" & gt; & Lt; / Script & gt; & Lt; Script src = "Vimeoles / Common-Init.js" & gt; & Lt; / Script & gt; & Lt; Script src = "view model / dashboard-init.js" & gt; & Lt; / Script & gt; & Lt; / Body & gt;
needjs.config ( {BaseUrl: "../Scripts", path: {"jquery": "jquery-2.0.3.min", "jqueryui": "jquery-ui-1.11.4.min", "knockout": "Knockout - 3.3.0 "," Knockout-AMD-Helpers ":" Knockout-AMD-Helpers "," Text ":" Text "}, Shim: {'Grid List': ['jquery'], 'jquery.gridList': ['Jquery', 'gridlist']}
});
There is a dashboard-int
required (["knockout", "../viewmodels/modules/dashboard", "knockout-amd-helpers", "Text"], function (to, dashboard) {ko.amdTemplateEngine.defaultPath = "../templates"; ko.bindingHandlers.module.baseDir = "modules"; Ko.bindingHandlers.module.templateProperty = "embedded template"; SetTimeout (function () {ko.applyBindings (new dashboard ());}, 0);
}); Finally, here is the Dashboard module:
Define (["Knockout", "jquery", "jqueryui", "gridlist", "jquery.gridlist" ], Function (to) {return function () {var self = this; self.Panels = [{...}, {...}}; Self posterender = function (elements, data) {if (this. [This .forab. Length = 1] === data) {$ ('# grid'). Grid list ({lines: 3, widthHyatratio: 264/294, HeightToFontSizeRatio: 0.25});}}}
});
In addition to this, I do not like the fact that I need to refer to the # grid. See model but there is no better address than any advice would help.
Thanks
I have a grid list
I'm working with, but I think they have a check for the window. GridList
The error that you see is in an AMD setting, it is not visible on the window. Define (["knockout", "jquery", "gridlist", "jqueryui", "jquery.gridList"], function (to, $, gridlist)
{Window.GridList = GridList; // your other code}}; As far as the access to the #grid
element, you can enter any element in parentNode
or better use instead You can consider doing the basic element that actually starts the gridlists
.
No comments:
Post a Comment