asp.net mvc - jQueryUI Modal open event & MVC.NET causing error ".dialog is not a function" -
i hope can i'm @ wits end this. i'm trying this.
- "draggable" item dropped "droppable" area (this works)
- this posts id of item controller returns type of item (this works)
- i pass returned item name function opens modal , renders partial view in modal depending on particular item.
the last bit issue is. steps above work fine, modal popped , partial view rendered modal. button close dialog throws error ".dialog not function" , after closing modal using 'x' in corner subsequent attempts open modal not work throwing similar error.
here's example i'm working try working.
$(function () { $('.draggable').draggable({ containment: '#imageboundry', revert: 'valid' }); $('#droppable').droppable({ drop: function (event, ui) { $.ajax({ type: "post", url: '/home/addtocart/' + $(ui.draggable).attr("id"), success: function (data) { getitemtype(data); } }); } }); }); function getitemtype(itemname) { $('#dialogs').dialog({ open: function () { $(this).load("additionalcontent", { itemname: itemname }, function () { alert("this happened"); }); }, modal: true, resizable: false, title: itemname, width: 400, autoopen: false, buttons: { "confirm": function () { $(this).dialog('close'); } } }); }
this controller returns partial view modal
public partialviewresult additionalcontent(string itemname) { return partialview("_" + itemname + "attributes"); }
the close button works once take out open: function () { ... }
bit , can reopen modal again , again once put in error gets thrown. cause cannot life of me figure out why.
thanks in advance , sorry long post.
update:
i've attempted initializing modal in document.ready , call "drop" function in first main function. doing i've narrowed down line of code loads partial view controller. without line functionality works. ideas on wrong this.
$(this).load("additionalcontent", { itemname: itemname }
i figured out. included in partial views second call jquery library added automatically when view created. plus version 1.4.4 while using 1.5.1 straight google in _layout page. second jquery library breaking functionality there conflict between 2 versions. wasn't until watched firebug console noticed second loading of 1.4.4 library.
thanks help, feel bit of idiot lesson learned..... now
Comments
Post a Comment