我需要将url与sharepoint列表tr id连接起来

I need to concatenate url with sharepoint list tr id

本文关键字:tr 列表 id 连接 起来 sharepoint url      更新时间:2023-09-26

我需要从msunselectedtitle中提取ID,msunselected title是SharePoint 2007列表中ms-vb-title的子元素。然后将其与一个url连接以打开一个新窗口。窗口需要使用window.open()方法打开,这样我就可以控制大小并关闭菜单。按计算列在列表中创建链接将不起作用,因为它只会在包含所有菜单的选项卡中打开一个新窗口。我发现这里的代码("如何使用jQuery从嵌套在其他表中的表中获取ID值")很接近,但它返回了一个ID数组,而不是按表行。我是javascript/jquery的新手,所以我有点拘泥。请注意,我使用的ID嵌入在列表的"标题"字段中。Html节在这里。。。

    <TD class=ms-vb-title height="100%" sizset="50" sizcache011076027996994381="6">
       <TABLE onmouseover=OnItem(this) id=284 class=ms-unselectedtitle height="100%"
    cellSpacing=0 Type="" SUrl="" UIS="1024" 
    CId="0x010010381707B6E7FC45825D794C02F54155" CType="Item" MS="0" CSrc="" HCD="" 
    COUId="" OType="0" Icon="icgen.gif||" Ext="" Perm="0x400001f07ee71bef" 
    DRef="sites/site1/M/S/Lists/MAINT_ACTIONS" Url="/sites/site1/M/S/Lists
    /MAINT_ACTIONS/284_.000" CTXName="ctx1" sizset="50" sizcache011076027996994381="6">
          <TBODY beenthere="1">
             <TR>
                <TD class=ms-vb width="100%"><A onclick="GoToLink(this);return false;" 
    onfocus=OnLink(this) href="/sites/site1/M/S/Lists/MAINT_ACTIONS
    /DispForm.aspx?ID=284" target=_self>Item <IMG class=ms-hidden border=0 
    alt="Use SHIFT+ENTER to open the menu (new window)." src="/_layouts/images
    /blank.gif" width=1 height=1></A></TD>
                <TD><IMG style="VISIBILITY: hidden" alt=Edit src="/_layouts/images
    /menudark.gif" width=13></TD>
             </TR>
          </TBODY>
       </TABLE>
    </TD>

关闭的代码如下。。。

    // filter out all tables with immediate parent td.ms-vb-title
    // returns a collection
    var ids = $('.ms-unselectedtitle').filter(function() {
        return $(this).parent('td').hasClass('.ms-vb-title');
    // from resulting collection, grab all IDs
    }).map(function() {
       return this.id;
    // convert to array
    }).get();

有人能帮我吗?请注意,我正在尝试从行中的可单击链接访问ID。

我在SharePoint列表中创建了三列,最后一列将它们放在一起,从而解决了这个问题。

    getWin1 held ...onClick='javascript:window.open("... the first part of the
    script and was made default text for this single line text column.
    getWin2 held ...","_blank","toolbar=0,menubar=0,top=50,left=50,width=1024,
    height=800,scrollbars=0,resizable=0,location=0");return false;'... the
    second single line text column.
    getUrl concatenated the url to the ID from the list.
    =CONCATENATE("<span><input ",getWin1,getUrl,getWin2," type='image' 
    src='https://sof.socom.mil/sites/SORDAC/M/SharePoint_System_Files/Icons
    /Magnification_16.png'/></span>")... was put into the last column to
    combine the three columns.

我有文本到HTML的CEWP转换成HTML脚本。不是最佳解决方案,但它有效。请注意。。。只是标记了脚本的开始和结束。