jQuery UI Widgets Forums Navigation Expander unable to set sample on ASP.NET mvc

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 3 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • unable to set sample on ASP.NET mvc #86262

    Admir Hodžić
    Participant

    I am trying to copy / paste your sample to ASP.NET MVC so I can continue editing and setting it.
    I am trying to reproduce sample at
    http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxkanban/kanban-events.htm?bootstrap

    When I open view and try to drag kanban item i get errors in chrome console
    jqxkanban.js:7 Uncaught TypeError: Cannot read property 'id' of undefined

    when I open jqxkanban.js in chrome I get error in

    
    _addEventHandlers: function() {
                var b = this;
                b.addHandler(a(window), "resize.kanban" + b.element.id, function(c) {
                    b._recalculateContainersHeight();
                    b._calculateExpandedColumnsWidth()
                });
                b.addHandler(a(b._kanbanColumns), "start", function(d) {
                    b._selectedItemId = d.args.item.context.id; //HERE I GET EXCETPIN
                    b._draggedItemId = b._selectedItemId;
                    b._draggedItemDataId = a("#" + b._draggedItemId).data().kanbanItemId;
                    b._draggedItemValues = b._sourceKeys[b._draggedItemDataId];
                    b._selectedItemValues = b._draggedItemValues;
                    var c = a("#" + b._draggedItemId).height();
                    a(".jqx-kanban-item-placeholder").height(c)
                });

    Here is my View how looks like

    <div id="kanban"></div>
    <div id="log"></div>   
    
    @section scripts {
    <script type="text/javascript" src="~/Scripts/jquery-3.0.0.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxsortable.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxkanban.js"></script>
    <script type="text/javascript" src="~/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="~/Scripts/demos.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
    
            var fields = [
                     { name: "id", type: "string" },
                     { name: "status", map: "state", type: "string" },
                     { name: "text", map: "label", type: "string" },
                     { name: "tags", type: "string" },
                     { name: "color", map: "hex", type: "string" },
                     { name: "resourceId", type: "number" }
            ];
    
            var source =
             {
                 localData: [
                          
                          { id: "1645", state: "work", label: "Change Billing Address", tags: "billing", hex: "#f19b60", resourceId: 1 },
                          
                 ],
                 dataType: "array",
                 dataFields: fields
             };
    
            var dataAdapter = new $.jqx.dataAdapter(source);
    
            var resourcesAdapterFunc = function () {
                var resourcesSource =
                {
                    localData: [
                          { id: 0, name: "No name", image: "../../jqwidgets/styles/images/common.png", common: true },
                          { id: 1, name: "Andrew Fuller", image: "../../Content/slike/catalogicon.png" },
                    ],
                    dataType: "array",
                    dataFields: [
                         { name: "id", type: "number" },
                         { name: "name", type: "string" },
                         { name: "image", type: "string" },
                         { name: "common", type: "boolean" }
                    ]
                };
    
                var resourcesDataAdapter = new $.jqx.dataAdapter(resourcesSource);
                return resourcesDataAdapter;
            }
    
            var log = new Array();
            var updateLog = function () {
                var count = 0;
                var str = "";
                for (var i = log.length - 1; i >= 0; i--) {
                    str += log[i] + "<br/>";
                    count++;
                    if (count > 10)
                        break;
                }
                $("#log").html(str);
            }
    
            $('#kanban').jqxKanban({
                resources: resourcesAdapterFunc(),
                source: dataAdapter,
                columns: [
                    { text: "Backlog", dataField: "new" },
                    { text: "In Progress", dataField: "work" },
                    { text: "Done", dataField: "done" }
                ]
            });
    
            $('#kanban').on('itemMoved', function (event) {
                var args = event.args;
                var itemId = args.itemId;
                var oldParentId = args.oldParentId;
                var newParentId = args.newParentId;
                var itemData = args.itemData;
                var oldColumn = args.oldColumn;
                var newColumn = args.newColumn;
    
                log.push("itemMoved is raised");
                updateLog();
            });
    
            $('#kanban').on('columnCollapsed', function (event) {
                var args = event.args;
                var column = args.column;
    
                log.push("columnCollapsed is raised");
                updateLog();
            });
    
            $('#kanban').on('columnExpanded', function (event) {
                var args = event.args;
                var column = args.column;
    
                log.push("columnExpanded is raised");
                updateLog();
            });
    
            $('#kanban').on('itemAttrClicked', function (event) {
                var args = event.args;
                var itemId = args.itemId;
                var attribute = args.attribute; // template, colorStatus, content, keyword, text, avatar
    
                log.push("itemAttrClicked is raised");
                updateLog();
            });
    
            $('#kanban').on('columnAttrClicked', function (event) {
                var args = event.args;
                var column = args.column;
                var cancelToggle = args.cancelToggle; // false by default. Set to true to cancel toggling dynamically.
                var attribute = args.attribute; // title, button
    
                log.push("columnAttrClicked is raised");
                updateLog();
            });
        });
    
    </script>
    
    }

    Is this in common whit jquery-3.0.0 version.
    But I have success writing Views whit other jqwidgets as Grid, Validator, combobox ?
    Is there any way to get working sample for ASP.NET MVC of kanban widget

    unable to set sample on ASP.NET mvc #86269

    Hristo
    Participant

    Hello adopilot,

    Unfortunately, we do not have support for jQuery 3.0.0 yet.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.