簡體   English   中英

如何從其他刀片文件打開引導模式? (拉拉維爾)

[英]how to open bootstrap modal from other blade file ? (laravel)

1.this is present in file index.blade.php.In this between html code an button tag is placed in which data target is present in different file.Can it's possible to trigger the modal from remote button

<button class="btn btn-small btn-warning btn-circle" data-toggle="modal" data-target=".ept-modal" onclick="productTestMapModal('<?=base64_encode(base64_encode($product->id));?>')">Available Tests</button>

2.而模態目標文件是

<div class="clear-back">
<div class="modal-header">
    {{ $product->name }} - Available tests
    <button type="button" title="Close" class="close pull-right white" data-dismiss="modal">
        <i class="material-icons">close</i>
    </button>
</div>
<div class="pad-15">
    <span class="text-success"><i class="fa fa-circle user-online"></i> Select tests to be mapped in {{ $product->name }}</span>
    
    <button class="btn btn-primary pull-right btn-circle" onclick="productTestMap(this, '<?=base64_encode(base64_encode($product->id));?>')">Save</button>
    
    <div class="clearfix"></div><br/>
    

    <div style="width:99%;overflow-y:auto;">
        <table class="table">
            <thead>
                <tr class="center">
                    @foreach($product->course->testGroups as $testgroup)
                        <th>{{ $testgroup->name }}   
                            <button class="btn btn-primary btn-circle btn-sm" onclick="selectTestgroups('{{$testgroup->id}}')">Select All</button>
                            <button class="btn btn-primary btn-circle btn-sm" onclick="unselectTestgroups('{{$testgroup->id}}')">UnSelect All</button>
                        </th>
                    @endforeach
                </tr>
            </thead>
            <tbody>
                <tr>
                    @foreach($product->course->testGroups as $testgroup)
                        <td>
                            @foreach($testgroup->subgroups as $subgroup)
                                @foreach($subgroup->tests as $t)
                                    <span class="badge badgetest_{{$testgroup->id}} {{ in_array($t->id,$product_tests) ? 'selected' : '' }}" onclick="toggleSelection(this)"><span class="test-id hidden">{{ $t->id }}</span>{{ $t->name }}</span>
                                @endforeach
                            @endforeach
                        </td>
                    @endforeach
                </tr>
            </tbody>
        </table>
    </div>

    <div class="clearfix"></div><br/>
</div>

為了從另一個刀片文件打開模態,您必須在目標文件 index.blade.php 中包含該文件,按鈕,如下所示: @include('rel_path_to_modal_file.modal_file_name')

請按照引導文檔使用模態,因為它通過 id 調用,而不是 class。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM