Adding Edit Dialog to a Data Form Web Part

Edit Dialog

Edit Dia­log

A client asked me to cre­ate a roll-up of some doc­u­ment libraries, and I decided to exer­cise the data form web part. It worked fine until I was asked why he got an open/save dia­log and not the stan­dard Share­Point read-only/edit dia­log from doc­u­ment libraries as to the right.

After some help from some Twit­ter folk (@zai­jian and @gvaro) it was made evi­dent that there is some JavaScript that sur­rounds the anchors in the doc­u­ment library.  After com­par­ing AllItems.aspx to my cus­tom page I saw the JavaScript not included. I then added the JavaScript ref­er­ences around my XSL, and sure enough I got the dialog!

I tried to go one step far­ther and the whole con­text menu, but I was only able to get por­tions of us such as the gold hover bar. I know there were some hid­den divs the JavaScript used, but alas I had other work to move onto. If any­one has expe­ri­ence with adding the whole con­text menu I’d be glad to add it here for others.

<a onclick="return DispEx(this,event,'TRUE','FALSE','TRUE','SharePoint.OpenDocuments.3','0','SharePoint.OpenDocuments','','','','110','0','0','0x7fffffffffffffff')" href="{@FileRef}" onfocus="OnLink(this)"><xsl:value-of select="@FileLeafRef" /></a>

2 Comments

  1. The sucky thing is that the SP javascript libraries play a huge part in how the SP UI works, but there’s no API or MSDN ref­er­ences for them.

    zaijian on 03.20.09
  2. I just found that out myself. It is quite surprising.

    Chris Poteet on 03.20.09

Got Something to Say?

(Required)
(Required)