小编dan*_*ght的帖子

智能表 - 从代码设置页面

我正在使用非常好的表库Smart-table来显示我的数据.

我正在使用自定义分页模板.但是,我希望能够从代码中设置第1页.我已经阅读了它暴露的st-pipe指令,但是如果我实现它,我似乎需要自己重写整个过滤/分页/排序代码.

我正在以一种简单的方式以编程方式从st-pagination我表中存在的指令外部设置页面tfoot

<table st-table="displayedCollection" st-safe-src="tags" class="table table-hover">
    <tbody>
        <tr st-select-row="tag" st-select-mode="single" ng-repeat="tag in displayedCollection" ng-click="click(tag)">
            <td>
                <span editable-text="tag.name" e-placeholder="enter a display name..." e-name="name" e-form="editableForm" e-required>
                {{tag.name}}</span>
            </td>
            <td>
                <span editable-text="tag.path" e-placeholder="enter actual value to be used..." e-name="path" e-form="editableForm" e-required>
                {{tag.path}}</span>
            </td>
            <td>
                <form editable-form shown="newItem == tag" onshow="onShow()" name="editableForm" oncancel="oncancel(newItem)" onaftersave="saveForm(tag)">
                    <!-- EDIT -->
                    <button type="button" class="btn btn-sm btn-default" ng-click="editableForm.$show()" tooltip="Edit" tooltip-placement="left" ng-hide="editableForm.$visible">
                        <i class="fa fa-pencil-square-o fa-lg"></i>
                    </button>
                </form>
            </td>
        </tr>
    </tbody>
    <tfoot>
        <tr> …
Run Code Online (Sandbox Code Playgroud)

angularjs smart-table

6
推荐指数
1
解决办法
5309
查看次数

Child_process 处理带有回车 (\r) 的 STDOUT 流

我正在编写一个简单的(ish)应用程序,它允许工作中的内部系统从远程服务器请求复制过程(使用 rsync)到另一个使用 REST 调用发起的远程服务器。

我对express框架已经足够熟悉了,刚开始尝试child_process库,偶然发现了一个小问题。

我使用 node's 成功启动了 rsync 进程childProcess.spawn(),我的问题是 rsync 输出其进度行缓冲,用回车符 (\r) 而不是换行符 (\n)。因此,STDOUT 事件process.stdout.on('data', {})只在说它正在设置传输之前被调用一次,然后在复制完成后,因为 STDOUT 数据不会在回车时刷新,随着进度更新,只有一个换行符,当工作完成。

在最新版本的 rsync (3.1.0) 中有一个开关可以将输出缓冲区结尾更改为 \n 而不是 \r 但不幸的是,我工作的公司很长一段时间都不会采用这个版本。

我正在以通常的方式生成和读取 child_process ....

var doCopy = function (onFinish) {
    var process = childProcess.spawn('ssh', [
        source.user + "@" + source.host,
        "rsync",
        "-avz",
        "--progress",
        source.path + source.file,
        "-e ssh",
        dest.user + "@" + dest.host + ":" + dest.path
    ]);

    process.on('error', function (error) {
        console.log("ERR: " + error.code);
    })

    process.stdout.on('data', function (data) …
Run Code Online (Sandbox Code Playgroud)

javascript rsync stream child-process node.js

5
推荐指数
1
解决办法
1837
查看次数