简体   繁体   English

弹出式窗口未显示在表格行内的按钮中

[英]Popover not showing in button inside table row

I have a table being built via the map function of JavaScript (ReactJS). 我有一个通过JavaScript的map函数(ReactJS)构建的表。

On the last column, I should be having buttons that are meant to open a popover that will (eventually) hold some information. 在最后一列上,我应该有一些按钮用来打开一个(最终)保存一些信息的弹出窗口。 This cell is being done like this: 这个单元格是这样完成的:

<td>
    <div>
        <button className="btn btn-primary"
                tabIndex="0"
                role="button"
                data-toggle="popover"
                data-trigger="focus"
                title="Details"
                data-content="Testing, Testing">
               <b>IN PIT</b>
         </button>
    </div>
</td>

So far, the said button appears, but no popover whatsoever. 到目前为止,该按钮出现了,但是没有弹出窗口。 I'm not using npm or anything of the sorts since I'm not a front-end-designer myself, and that doesn't seem trivial to setup. 因为我自己不是前端设计师,所以我不使用npm或任何种类的东西,并且设置似乎并不简单。 I just want something "good enough" for testing purposes. 我只想要“足够好”的东西用于测试。

What am I missing? 我想念什么?

The names of your attributes imply that you are expecting bootstrap (an external library) to be loaded and attach to the element to provide functionality, is bootstrap included in a script tag on the page? 属性名称暗示您期望引导程序(外部库)被加载并附加到元素上以提供功能,引导程序是否包含在页面的脚本标记中? Those attributes don't do anything themselves, they are just tags to attach actions to. 这些属性本身不做任何事情,它们只是将动作附加到的标签。 Add a bootstrap cdn tag inside the bottom of the body tag to address. 在body标签底部添加一个bootstrap cdn标签以进行寻址。

Looking at your https://pastebin.com/KuRHjWxr . 查看您的https://pastebin.com/KuRHjWxr Popovers won't work, you have to implement them other way. 弹出式窗口不起作用,您必须以其他方式实现它们。 You initiate $('[data-toggle="popover"]').popover(); $('[data-toggle="tooltip"]').tooltip(); 您启动$('[data-toggle="popover"]').popover(); $('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="popover"]').popover(); $('[data-toggle="tooltip"]').tooltip(); when there are no buttons in DOM. 当DOM中没有按钮时。

Call .popover() and .tooltip() after your buttons are successfully rendered to the DOM. 将按钮成功呈现到DOM后,调用.popover().tooltip()

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM