2

I have an initiation form for my workflow. The form uses a people/user picker. This picker opens a dialog, in that dialog the div in which list of people appears comes with a small height in Internet Explorer 10.

I want to change that using css. As it uses systems master page, I can't directly add css to it. I want to change css using script for which I want to use event like dialog open so that after the dialog opens I can change the css of it.

Is there any way to capture open event of dialog?

1

You could perhaps do something like the following in JS.

Override the default implementation of showModalDialog in JS. Create a tmp-pointer to the old method. Override the showModalDialog to your own method, with your own code/event capturing the showModalDialog.

Something like this for a normal modal dialog:

var oldMethod = SP.UI.ModalDialog.showModalDialog;

SP.UI.ModalDialog.showModalDialog = function (options) {
    var defd;
    try {
       defd = typeof ();
    } catch (e) {
        defd = "undefined"
    }
    EnsureScript("SP.UI.Dialog.js", defd, function () {   oldMethod(options);
      // Custom code - Fetch the div tag using jquery and with a specific id=MyDiv
      $("#MyDiv").css({ height: "20px"});

 });
};

Not sure if the picker uses the same method. If it doesn't, I'd try to debug to find the correct method to overload in a similar way.

  • thanks @CmdrTchort. yes showModalDialog method is called when opening picker. It has a small issue as the picker page opens in an iframe, iframe may take some time to load we don't know how much. and i have to change css of element inside that iframe. If i run the code when dialog is called it may not find the rquired element. I had to complete that task in hurry so i used a not so good way to solve that issue (I called a function every few seconds using setinterval, which will apply css whenever that element is found inside that iframe.) I will explore more using your method when i have time. – mry Aug 16 '13 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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