Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sapui5 如何在sap.m.ProgressIndicator on中禁用动画;百分比值“;改变_Sapui5 - Fatal编程技术网

Sapui5 如何在sap.m.ProgressIndicator on中禁用动画;百分比值“;改变

Sapui5 如何在sap.m.ProgressIndicator on中禁用动画;百分比值“;改变,sapui5,Sapui5,正如标题所述,在更改sap.m.ProgressIndicator的百分比值时,如何使不设置动画 我找不到解决这个问题的方法,扩展可能是一条路,但也许有人已经找到了解决方法并完成了? 我的谷歌搜索没有成功。有趣的问题,下面是sap.m.ProgressIndication.prototype.setPercentValue函数,您可以看到百分比值改变时,条形图的值通过线性动画改变 sap.m.ProgressIndicator.prototype.setPercentValue = functi

正如标题所述,在更改
sap.m.ProgressIndicator的百分比值时,如何使
不设置动画

我找不到解决这个问题的方法,扩展可能是一条路,但也许有人已经找到了解决方法并完成了?
我的谷歌搜索没有成功。

有趣的问题,下面是sap.m.ProgressIndication.prototype.setPercentValue函数,您可以看到百分比值改变时,条形图的值通过线性动画改变

sap.m.ProgressIndicator.prototype.setPercentValue = function(fPercentValue) {

var that = this;
 ...
if (that.getPercentValue() != fPercentValue) {
    // animation without rerendering
    this.$().addClass("sapMPIAnimate");
    var time = Math.abs(that.getPercentValue() - fPercentValue) * 20;
    this.setProperty("percentValue", fPercentValue, true);
    var $Bar = this.$("bar");
    $Bar.animate({
        width : fPercentValue + "%"
    }, time, "linear", function() {
        that._setText.apply(that);
        that.$().removeClass("sapMPIAnimate");
    });
}
我的建议是,更改此行为的最简单方法是将控件扩展到您自己的控件并重新定义setPercentValue,或者删除工具栏上的动画功能,或者将时间设置为null,这样就没有动画

sap.m.ProgressIndicator.prototype.setPercentValue = function(fPercentValue) {

var that = this;
 ...
if (that.getPercentValue() != fPercentValue) {
    // animation without rerendering
    this.$().addClass("sapMPIAnimate");
    var time = Math.abs(that.getPercentValue() - fPercentValue) * 20;
    this.setProperty("percentValue", fPercentValue, true);
    var $Bar = this.$("bar");
    $Bar.animate({
        width : fPercentValue + "%"
    }, time, "linear", function() {
        that._setText.apply(that);
        that.$().removeClass("sapMPIAnimate");
    });
}
差不多

jQuery.sap.declare("my.ProgressIndicator");
jQuery.sap.require("sap.m.ProgressIndicator");
sap.m.ProgressIndicator.extend("my.ProgressIndicator", {
   renderer: {} 
});

my.ProgressIndicator.prototype.setPercentValue = function(fPercentValue) {

  var that = this;

// validation of fPercentValue
if (typeof (fPercentValue) == "number") {
    if (that.getPercentValue() != fPercentValue) {
        // animation without rerendering
        this.$().addClass("sapMPIAnimate");
        //var time = Math.abs(that.getPercentValue() - fPercentValue) * 20;
        var time = 0;
        this.setProperty("percentValue", fPercentValue, true);
        var $Bar = this.$("bar");
        $Bar.animate({
            width : fPercentValue + "%"
        }, time, "linear", function() {
            that._setText.apply(that);
            that.$().removeClass("sapMPIAnimate");
        });
    }

    return this;
};

没有方便的方法来抑制这种行为


您只能扩展控件并将方法setPercentValue覆盖到所需的行为。

从UI5 1.73开始,可以通过将属性设置为
false
来关闭
percantiveValue
-change上的动画

确定是否在动画中显示百分比更改。
自:1.73


对于UI5 1.73及以上版本的读者: