【发布时间】:2015-12-10 06:26:00
【问题描述】:
我的问题是:
- 当我单击打印按钮时,它以不在表格中的文本显示数据。
- 我要打印的数据表依赖于当前表的显示。方法 这是当前页面上的所有数据列表和选择选项。 当我选择或过滤表时,它仍会打印所有数据。数据 这里是从数据库中收集的。
- 为什么登录后没有显示下一页的图片?
这是我的 JavaScript:
<script lang='javascript'>
$(document).ready(function(){
$('#printPage').click(function(){
var data = '<input type="button" value="Print this page" onClick="window.print()">';
data += '<div id="div_print">';
data += $('#report').html();
data += '</div>';
myWindow=window.open('','','width=200,height=100');
myWindow.innerWidth = screen.width;
myWindow.innerHeight = screen.height;
myWindow.screenX = 0;
myWindow.screenY = 0;
myWindow.document.write(data);
myWindow.focus();
});
});
</script>
刀片模板:
<tbody id="result">
@foreach($profiles as $profile)
<tr>
<td class="student_id" width="15%">{{$profile->student_id }}</td>
<td class="name" width="30%">{{$profile->student_name }}</td>
<td class="program" width="30%"> {{$profile->program }}</td>
<td class="faculty" width="25%">{{$profile->faculty }} </td>
</tr>
@endforeach
</tbody>
</table>
<p align="center"><button id="printPage">Print</button></p>
【问题讨论】:
-
你想用什么打印数据?一个PDF?或只是到任何来源?
-
@GeethW 你能帮我吗,如何获取打印表格数据的参数? (例如过滤表)
-
所以你想把数据中的表格获取为PDF并打印出来?
-
我已经完成了 pdf 文件。但是,我不能只在它页面的显示表上显示数据.. 我的视图页面怎么样?如何调用要打印的选定数据?在这里,在打印视图页面上,我只是从数据库中一一手动调用。我想打印屏幕上唯一显示的一个@GeethW
-
所以要打印特定记录?
标签: javascript laravel-5