2014-10-09 33 views
0

我试图编写代码,当单击链接时将显示网格,并且我设法获取链接显示,但未能在网格底部显示网格页。谢谢你的帮助。使用打字稿显示从点击链接的网格

*

export function setCustomLinkContent(divId: string, field: propertybox.Field) { 

      var container = $('#' + divId); 
      container.height(70); 
      container.width(260); 

      container.append("<p><a target='_blank' href=\"http://localhost\">View all works</a></p>"); 
      this.container.prepareGridContainer(); 
      var gridContainer = $("#" + this.container); 
      var gridContHeight = gridContainer.height() - 27 - 43; 
      var workHtml = 
       "<div id='" + this.workContainer + "-heading' class='orm-table-title'>" + 
       "<label>" + this.headerLabel + "</label>" + 
       "</div>" + 
       "<div id='" + this.workContainer + "-table' class='map-work-grid' style='height: " + gridContHeight + "px'>" + 
       "<table style='margin: 0 auto; width: 100%; overflow-x: auto'>" + 
       "<thead>" + 
       "<tr id='" + this.tableHeader + "'></tr>" + 
       "</thead>" + 
       "<tbody id='" + this.tableBody + "'></tbody>" + 
       "</table>" + 
       "</div>"; 
      gridContainer.append(workHtml); 

     } 

*

+0

我想$( “#” + this.container)没有返回jQuery对象。 – 2014-10-09 09:29:39

+0

是否意味着它必须是this.divId? – user3635322 2014-10-09 09:43:55

+0

可能。也许在浏览器中使用断点并检查当前作用域中的变量可能会有所帮助。这样你就可以看到你的当前“this”引用是否有成员divId及其值。 – 2014-10-09 09:49:09

回答

0

很可能你打错。由于你的功能不属于类这个在这里似乎没有意义。

更多thishttps://www.youtube.com/watch?v=tvocUcbCupA&hd=1

+0

中的函数,现在我明白了,我会重写我的代码,看看我哪里出错了,我会在工作时发布我的代码。谢谢 – user3635322 2014-10-09 11:00:41