在 dojo 内容窗格中从 html 加载特定的 id 内容
loading specific id content from html in dojo content pane
我正在尝试通过单击树节点在 Dojo 内容窗格中加载特定 html id 内容。
我有一个很长的 html,其中有几个标题。我试图通过单击树节点从这个 html 加载内容。我能够加载 html,但无法将具有特定 ID 的内容置于内容窗格顶部。
说我的 html 是 abc.html
并且它有几个 ID 说 id1
, id2
...
如果我在 IE 中使用参数 abc.html
打开此 html,页面将被加载,第一行在顶部。现在,如果我用参数 abc.html#id9
打开它
html 的这个特定部分被加载到 IE window 的顶部。
我正在尝试在 dojo 内容窗格中实现相同的效果 - 这里的内容是在单击树节点时加载到 Dojo ContentPane 中,目标是加载特定 #id
与内容窗格中的树节点相关联,而不是正在加载 html.
的顶部
它从不在内容窗格顶部加载特定的 id 内容。它总是像参数是 abc.html
一样加载。我没有看到 abc.html#id9
的任何效果
下面是有关我如何创建内容窗格并在单击树节点时加载内容的代码片段。
....
var CenterPane = new ContentPane({//content pane at center for loading urls of selected designs
content:"Click to get the details about node",
region:"center"});
bordContainer.addChild(CenterPane);//add content pane to the border container
....
....
var fileTree = new Tree ({
model: treeModel,
showRoot: false,
openOnClick:true,
autoExpand:false,
_createTreeNode: function (args)
{
return new MyTreeNode(args);
},
onClick: function(args) {
CenterPane.set("href", vHtmlPath); }
....
vHtmlPat
h 动态设置为 abc.html#id9
或 abc.html#id1
....
ContentPane 没有加载到 iframe 中。如果要移动,则必须更改当前页面url。
例如
CenterPane.set("href", vHtmlPath).then(function() {
document.location.href = "#id9"
}
我正在尝试通过单击树节点在 Dojo 内容窗格中加载特定 html id 内容。 我有一个很长的 html,其中有几个标题。我试图通过单击树节点从这个 html 加载内容。我能够加载 html,但无法将具有特定 ID 的内容置于内容窗格顶部。
说我的 html 是 abc.html
并且它有几个 ID 说 id1
, id2
...
如果我在 IE 中使用参数 abc.html
打开此 html,页面将被加载,第一行在顶部。现在,如果我用参数 abc.html#id9
打开它
html 的这个特定部分被加载到 IE window 的顶部。
我正在尝试在 dojo 内容窗格中实现相同的效果 - 这里的内容是在单击树节点时加载到 Dojo ContentPane 中,目标是加载特定 #id
与内容窗格中的树节点相关联,而不是正在加载 html.
它从不在内容窗格顶部加载特定的 id 内容。它总是像参数是 abc.html
一样加载。我没有看到 abc.html#id9
下面是有关我如何创建内容窗格并在单击树节点时加载内容的代码片段。
....
var CenterPane = new ContentPane({//content pane at center for loading urls of selected designs
content:"Click to get the details about node",
region:"center"});
bordContainer.addChild(CenterPane);//add content pane to the border container
....
....
var fileTree = new Tree ({
model: treeModel,
showRoot: false,
openOnClick:true,
autoExpand:false,
_createTreeNode: function (args)
{
return new MyTreeNode(args);
},
onClick: function(args) {
CenterPane.set("href", vHtmlPath); }
....
vHtmlPat
h 动态设置为 abc.html#id9
或 abc.html#id1
....
ContentPane 没有加载到 iframe 中。如果要移动,则必须更改当前页面url。 例如
CenterPane.set("href", vHtmlPath).then(function() {
document.location.href = "#id9"
}