如何隐藏包装跨度(输入)并在下面显示跨度?

时间:2018-10-12 10:03:34

标签: jquery kendo-ui

请查看所附的屏幕截图:

enter image description here

我们使用Kendo UI和JQuery。代码如下:

1)对于使用NumericTextBox的突出显示的单元格:

this.addChild("netSum", new ui.NumericTextBox($(`input[name='row.netSum${this.suffix}']`, this.fn), { tag: "netSum", binder: ui.bindTo(this.options.data, "netSum"), minValue: this.getMinValue(), text: "" }));

2)在.cshtml文件中:

<script id="billGridTotalRowTemplate" type="text/x-jsrender">
  <tr class="invoice-totals">
    <td colspan="2" class="first"><i class="uicon-plus txt-success"></i><a href="#" class="alt add-row block-inline">Добавить строку</a></td>
    <td colspan="2"><span class="txt-table">Всего к оплате</span></td>
    <td>
      <input name="netsum" type="text" />
      <span id="netSumFake" class="txt-table">test</span>
    </td>
    <td></td>
    <td>
      <input name="vatsum" type="text" />
    </td>
    <td>
      <input name="totalsum" type="text" />
    </td>
    <td class="last"></td>
  </tr>
</script>

3)NumericTextBox:

(function () {
    function numericTextBox() {
        numericTextBox.superclass.constructor.apply(this, arguments);
        this.params = $.extend(true, {
            val: null,
            minValue: null,
            maxValue: null,
            digits: 2,
            groupSize: 3,
            step: 1,
            negative: 1,
            spinners: false,
            text: "",
            inputAttributes: { maxlength: 17 },
            format: "n"
        }, this.params);
        this.tControl = this.fn.kendoNumericTextBox({
            change: $.proxy(this.onChange, this),
            type: "numeric",
            min: this.params.minValue,
            max: this.params.maxValue,
            decimals: this.params.digits,
            groupSize: this.params.groupSize,
            step: this.params.step,
            negative: this.params.negative,
            spinners: this.params.spinners,
            text: this.params.text,
            inputAttributes: this.params.inputAttributes,
            format: this.params.format
        }).data("kendoNumericTextBox");
    }

    extend(numericTextBox, ui.WrappedControl);

    numericTextBox.prototype.disable = function () {
        this.fn.hide();
        this.fn.next(".txt-table").show();
    };

    ui.NumericTextBox = numericTextBox;
})();

我们要隐藏具有“ netsum”名称的“输入”,并显示具有“ netSumFake” ID的“跨度”。

对jQuery方法hide()和show()的调用不起作用。

0 个答案:

没有答案