简体   繁体   English

如何将div添加到extjs对象中?

[英]How to add div to extjs object?

I have a javascript method. 我有一个javascript方法。 This method using div object for work. 此方法使用div对象进行工作。 For example: 例如:

g = new Method(document.getElementById(div_id),... }).

How to add result of this method to Extjs tab panel ?, 如何将此方法的结果添加到Extjs选项卡面板?,

tab.add({ html: "<div='div_id'></div>" }) 

- it's work, but I tthink is not correct. -可以,但是我认为不正确。

In the code where you create the tab you can get the div by the following: 在创建选项卡的代码中,可以通过以下方式获取div:

var theDiv = Ext.get("div_id");
tab.add({renderTo : theDiv }) //I believe that should work but I haven't test it.

So you could modify the div in your function. 因此,您可以在函数中修改div。 Then in EXT use the above method to get the div and add it to the tab. 然后在EXT中使用上述方法获取div并将其添加到选项卡。

如何添加多个<div>标签到 javascript object</div><div id="text_translate"><p> 我有几个对象,当我将它们添加到 innerHTML 时,我希望用一个“div”元素包含每个 object。 因此,“feelings”将包含在一组“div”元素中,而“feelings2”将包含在它自己的一组“div”元素中。 谁能帮我?</p><p> 下面是 javascript 代码中引用的 HTML</p><pre> <div class="tables"> <table > <tbody class="row" id="tableData"></tbody> </table></pre><p> 这 2 个是 object 样本。</p><pre> const feelings = [ { menuItem: happy[0], description: happy[1], value: 5 }, { menuItem: excited[0], description: excited[1], value: 6 }, { menuItem: sad[0], description: sad[1], value: 1 }, { menuItem: furious[0], description: furious[1], value: 0 } ]; const feelings2 = [ { menuItem: happier[0], description: happier[1], value: 5 }, { menuItem: excited2[0], description: excited2[1], value: 6 }, { menuItem: sadder[0], description: sadder[1], value: 1 }, { menuItem: furious2[0], description: furious2[1], value: 0 } ];</pre><p> 这是将对象数据添加到 innerHTML 的 javascript</p><pre> let tbody = '<tbody>'; function addToTableBody(feeling) { let returnVal = ""; for (const { menuItem, description, value } of Object.values(feeling)) { returnVal += ` <tr class="rows"> <td class="menuItem">${menuItem}</td> <div class="hide description">${description}</div> <td>${value}</td> </tr> ` } return returnVal; } tbody += addToTableBody(feelings) tbody += addToTableBody(feelings2); tbody += '</tbody>'; document.getElementById('tableData').innerHTML = tbody;</pre></div> - how to add multiple <div> tags to a javascript object

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何向 Extjs 日期对象添加小时数 - How to add hours to Extjs date object 如何在div中添加对象 - how to add an object in a div 如何在Extjs中向div添加双击事件 - How do you add a double click event to a div in Extjs 将数组添加到extjs中的json对象 - Add an array to a json object in extjs 如何在extjs中添加事件监听器 - How to add an eventlistener in extjs 无法将网格添加到extjs中的div - Can't add a grid to a div in extjs 如何在中添加raphaeljs对象 <div> 标签 - How to add raphaeljs object in <div> tag 如何添加多个<div>标签到 javascript object</div><div id="text_translate"><p> 我有几个对象,当我将它们添加到 innerHTML 时,我希望用一个“div”元素包含每个 object。 因此,“feelings”将包含在一组“div”元素中,而“feelings2”将包含在它自己的一组“div”元素中。 谁能帮我?</p><p> 下面是 javascript 代码中引用的 HTML</p><pre> <div class="tables"> <table > <tbody class="row" id="tableData"></tbody> </table></pre><p> 这 2 个是 object 样本。</p><pre> const feelings = [ { menuItem: happy[0], description: happy[1], value: 5 }, { menuItem: excited[0], description: excited[1], value: 6 }, { menuItem: sad[0], description: sad[1], value: 1 }, { menuItem: furious[0], description: furious[1], value: 0 } ]; const feelings2 = [ { menuItem: happier[0], description: happier[1], value: 5 }, { menuItem: excited2[0], description: excited2[1], value: 6 }, { menuItem: sadder[0], description: sadder[1], value: 1 }, { menuItem: furious2[0], description: furious2[1], value: 0 } ];</pre><p> 这是将对象数据添加到 innerHTML 的 javascript</p><pre> let tbody = '<tbody>'; function addToTableBody(feeling) { let returnVal = ""; for (const { menuItem, description, value } of Object.values(feeling)) { returnVal += ` <tr class="rows"> <td class="menuItem">${menuItem}</td> <div class="hide description">${description}</div> <td>${value}</td> </tr> ` } return returnVal; } tbody += addToTableBody(feelings) tbody += addToTableBody(feelings2); tbody += '</tbody>'; document.getElementById('tableData').innerHTML = tbody;</pre></div> - how to add multiple <div> tags to a javascript object 如何在EXTJS 4中向网格添加工具栏 - How to add a toolbar to grid in EXTJS 4 如何在extjs中的小部件中添加工具提示? - how to add tooltip to widget in extjs?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM