- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 webix 开发完全是新手,没有找到太多关于我当前挑战的文档/帮助。
在我的 webix 应用程序中,我希望有一个按钮(名称为“查看报告”),单击该按钮将链接到本地光盘中的光盘文件并在弹出窗口中显示其内容。
我包含了到目前为止我可以编写的代码片段:
mytoolbar =
{ id:'tb',
view: 'toolbar',
height: rowHeight,
type: 'clean',
cols: [
{view:"button", id:"showfile", type:"icon", icon:"external-link", label:"View Report", width:buttonWidth, tooltip: "click to view report", on: {onItemClick:function(){viewReportFile()}} },
]
viewReportFile 函数如下所示(摘自 http://docs.webix.com/desktop__window.html )
function viewReportFile(){
webix.ui( {
view:"window",
height:250,
width:300,
left:50, top:50,
move:true,
resize: true,
head:"This window can be resized",
body:{
template:"Some text"
}
}).show();
})
}
单击按钮应读取驻留在我的目录中的文件(假设位于 C:\Users\myname\Desktop\report.txt")并在模式窗口中显示该文件内容。它可以是任何要显示的弹出窗口文件内容带有关闭按钮。任何人都可以帮助我实现吗?我很抱歉无法在此处放置太多代码,因为我是新手。
我还包含一个工作代码,它允许用户从其目录中选择一个文件并在文本区域中显示其内容。
<html>
<input type="file" onchange="onFileSelected(event)">
<br>
<textarea id="result" rows="10" cols="50"></textarea>
<script>
function onFileSelected(event) {
var selectedFile = event.target.files[0];
var reader = new FileReader();
var result = document.getElementById("result");
reader.onload = function(event) {
result.innerHTML = event.target.result;
};
reader.readAsText(selectedFile);
}
</script>
</html>
谢谢。
最佳答案
这是一个示例,但请记住,执行此操作的方法有很多种,并且该示例不应最适合您的具体情况:
http://webix.com/snippet/36341f3c
function loadReport() {
return "My report string";
}
function viewReportFile() {
$$('myContent').define('template', loadReport());
$$('myPopup').show();
}
webix.ui({
id: 'myPopup',
view:"window",
height:250,
width:300,
left:50,
top:50,
move:true,
resize: true,
head:"This window can be resized",
body:{
id: 'myContent',
template: "Some text"
}
});
关于javascript - 如何在 webix 应用程序中读取和查看光盘文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43206074/
我想用 list-style-type: disc; 列出一些程序。 但是列表项没有这个“disc”并且有滚动条,我不知道为什么......看这里(Link)。 它应该只是一个带有光盘图标的列表,每个
使用 cygwin 终端,我的 .bashrc 中有以下内容: export WINHOME="/cygdrive/c/Users/userName" export TUTORING="$WINHOM
我创建了一个别名,以免每次我移动到一个新目录时都写 ls: alias cl='cd_(){ cd "$@" && ls; }; cd_' 假设我有一个名为“下载”的文件夹(我当然碰巧有),所以我只需
我是一名优秀的程序员,十分优秀!