Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

So I understand this is a strange question, but is there a way to use content displayed in a SharePoint modal, in a jQuery modal instead. I like the styling jQuery offers, but the SharePoint modal comes from a CQWP link. I basically just modified the CQWP template to include

<a href="{$SafeLinkUrl}" title="{@LinkToolTip}" class="ModalDialog">

and then simply added the following jQuery to the page via CEWP

$(document).ready(function(){
    var itemLink = "";
    $("a.ModalDialog").click(function(event){ 
        event.preventDefault();
        itemLink = $(this).attr('href'); 
        openModalDialog(itemLink);
    });
});

function openModalDialog(itemLink) {
    var options = {
        url: itemLink,
        width: 800,
        height: 600,
    };
SP.UI.ModalDialog.showModalDialog(options);
} 

I am curious as to whether or not I can extract specifics via the ItemStyle, or even here and through it into a jQuery modal instead. I have learned the modal pieces in a very simple format with using divs and such, so I understand that I could write queries in order to get the data, load the divs, create my own links, etc but I would really like to get there through this modified CQWP if that is possible/feasible...

End goal is to get rid of the ribbon, handle my own events with buttons and show only the content I wish to show in the modal, but still use the CQWP on the page and links to open the modal display.

Does this make sense? Appreciate any help or advice as always guys! Thanks

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

You could attempt to add your own JavaScript to each page that overrides the "SP.UI.ModalDialog.showModalDialog" function. Something like:

SP.UI.ModalDialog.showModalDialog = function (options) {

}

Don't know how reliable it would be, but it is an option.

share|improve this answer
    
interesting John. this seems to be working. though to get one complete example, it ends up being more work on the ouput, but less on the data roll up. kinda the opposite of qrying building page layout, then loading that with links that use .dialog. perhaps it was silly to begin with as this is a very round about way, but I was really just curious. its actually working though, thanks! –  Justin Aug 13 '12 at 11:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.