Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jasny引导行链接模式调用_Javascript_Html_Twitter Bootstrap_Jasny Bootstrap - Fatal编程技术网

Javascript Jasny引导行链接模式调用

Javascript Jasny引导行链接模式调用,javascript,html,twitter-bootstrap,jasny-bootstrap,Javascript,Html,Twitter Bootstrap,Jasny Bootstrap,我刚刚发现,当我试图查找类似.row link的内容时,bootstrap有一个扩展,所以当我在我的表上实现它时,当我单击每一行时,我似乎无法调用模式。boostrap中的模态将不会被调用。我真的找不到为什么,因为当我调试(使用firebug)页面时,td标签放在a标签的地方,我的a标签链接看不到。显示的仅为的值。 e、 g 但我真的不知道为什么不能使用行链接调用模态 同样,我的目标当我单击一行时,会出现一个模式框 这是我的代码片段 <table> <thead>

我刚刚发现,当我试图查找类似
.row link
的内容时,bootstrap有一个扩展,所以当我在我的表上实现它时,当我单击每一行时,我似乎无法调用模式。boostrap中的模态将不会被调用。我真的找不到为什么,因为当我调试(使用firebug)页面时,td标签放在a标签的地方,我的a标签链接看不到。显示的仅为的值。 e、 g
但我真的不知道为什么不能使用行链接调用模态

同样,我的目标当我单击一行时,会出现一个模式框

这是我的代码片段

<table>
   <thead>
        // some headers
   </thead>
   <tbody data-provides="rowlink">
      <tr>
        <td><a href="#myModal" data-toggle="modal" data-target="modal">Click me</a> </td>
        <td>/*some data*/</td>
        <td>/*some data*/</td>
      </tr>
   </tbody>
</table>

<div id="myModal" /*some legit modal attr please see bootstrap site i just copied them*/>
    <div>
        MODAL HEADER
    </div>

    <div>
        MODAL BODY
    <div>

    <div>
        MODAL FOOTER
    <div>
</div>

//一些标题
/*一些数据*/
/*一些数据*/
模态头
模态体
模态页脚
当我尝试此链接时,请注意此链接位于表格html标记之外

<a href="#myModal" data-toggle="modal" data-targe="modal">Click me</a>

任何人都知道如何在行链接内实现模式视图,请务必共享

如果您选中此项,下面的代码将从链接中获取href,并在单击行时将window.location更改为href,因此它需要一个URL

var href = link.attr('href')

$(this).find('td').not('.nolink').click(function() {
   window.location = href;
}) 
还有
。在这里,我给tr提供了一个类
.rowlink modal
,希望它可以被单击,并在脚本中以该类为目标,添加数据属性

$('.rowlink-modal').each(function(){
 $(this)
   .attr('data-toggle','modal')
   .attr('data-target','#myModal');
});
单击“操作”链接将打开modal2,当您单击整行时,第一个模式将打开。

Boostrap 3 这在引导程序3中是现成的

<table class="table table-striped table-bordered">
    <thead>
        <tr>
            <th>Name</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody data-link="row" class="rowlink">
        <tr>
            <td><a href="#myModal" data-toggle="modal">Modals</a></td>
            <td>some text</td>
            <td class="rowlink-skip"><a href="#myModal2" data-toggle="modal">Action</a></td>
        </tr>
    </tbody>
</table>

href=“#”
应该是
href=“#myModal”
opps编辑的。。我做了什么,对不起类型,问题仍然存在,实际上下面的一个已经工作了,但令人伤心的是它不是行链接,它只是在表外OK。我将#myModal添加到href inside
中,并将classes
将“model fade hide”
添加到modal中。实际上,当调用链接位于rowlink数据属性之外时,这种方法可以正常工作。对此没有问题,我的问题是当我将其放在rowlink表中时。。看到我的编辑,伙计,很抱歉更新太晚了,你和jasny扩展的开发者都提出了一些观点,当你使用js时,他明确地把数据属性放进去了。嗯,你们两个都是对的。。我想你是第一个我会选择这一天的好先生,是的,我明白了,有人已经做了一些js解决方案,但你的答案是一样的,唯一的问题是他用js把数据属性,而你的是明确写在trs上。。我会选择这个,因为他是第一个回答的人。无论如何,先生,这个例子是针对引导程序2的。我将添加一个bootstrap3示例。
<table class="table table-striped table-bordered">
    <thead>
        <tr>
            <th>Name</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody data-link="row" class="rowlink">
        <tr>
            <td><a href="#myModal" data-toggle="modal">Modals</a></td>
            <td>some text</td>
            <td class="rowlink-skip"><a href="#myModal2" data-toggle="modal">Action</a></td>
        </tr>
    </tbody>
</table>
<table class="table table-striped table-bordered">
    <thead>
        <tr>
            <th>Name</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        <tr class="rowlink" data-target="#myModal" data-toggle="modal">
            <td>Modals</td>
            <td>some text</td>
            <td class="nolink"><a href="#myModal2" data-toggle="modal">Action</a></td>
        </tr>
    </tbody>
</table>