javascriptsmartclient

Generates progress bars bysubmitbutton. Want to generate a progressbar for time (Assume 1 min).means user should see 0 to 100% feature for 1 min


I want to generate a progressbar for time (Assume 1 min). Means user should see 0 to 100% feature for 1 min.

isc.DynamicForm.create({
    ID:"DynamicForm51",
    autoDraw:false,


})

var importSection = isc.DynamicForm.create({
    ID:"DynamicForm42",
    autoDraw:false,
    numCols:2,
    width:950,
    items:[
        {
            name:"ImportSection",
            titleAlign:"center",
            textAlign:"center",
            align:"center",
            redrawOnChange:true,
            hoverAlign:"left",
            _constructor:"SelectItem"
        },
        {

            editorType: "button",

            //name:"SubmitItem",
            title:"Submit",
            align:"right",
            shouldSaveValue: true,
            _constructor:"SubmitItem",
            click : function() {

                //progressBar.hide();
                move();
                importSection.addItem(progressBar);

            }

        },
        {
            name:"Browse",
            textAlign:"right",
            align:"right",
            _constructor:"ButtonItem",
        },
        {
            colSpan:"*",
            endRow:true,
            //name:"CanvasItem0",
            showTitle:true,
            startRow:true,
            width:"*",
            canvas:DynamicForm51,
            _constructor:"CanvasItem"
        }



    ],

    cellPadding:2,
    minColWidth:20,
    fixedColWidths:false,
    saveOnEnter:true,
    titleOrientation:"left",
    titleWidth:500,
    layoutAlign:"right",
    visibility:"visible"

})

var progressBar = isc.Progressbar.create ({
    title: "Current Status Indicator",
    ID: "progressBar",
    showTitle:true,
    //ID: "progressBar",
    name: "progressBar",
    shouldSaveValue: true,
    //width:25,
    //height:10,
    length:250,
    titleAlign: "center",
    titleOrientation: "left",
    animateMoveTime: 10,

})

progressBar.hide();

function move() {

    //progressBar.show();

    progressBar.setPercentDone(50);


}

console.log(5):

Solution

  • function update() {
    var barValue = 0;
    var maxValue = 100;
    setInterval(function() {
           //var barValue = (1 + 100 * Math.random());  
            barValue += 5;
            progressBar.setPercentDone(barValue);
            //progressBar.animateShow();
             if (barValue >= maxValue) clearInterval(progressbar);
            progressBar.animateShow();
    
            console.log(barValue);
    

    }, 1000); }