function findOrder(){
            ctrl.order=[];
            var counter = ctrl.existingOrder.length;
                _(ctrl.selectedWidgets).forEach(function (selectedWidget) {
                   var index =  ctrl.existingOrder.indexOf(selectedWidget);
                    if(index>-1){
                        ctrl.order[index] = selectedWidget;
                    }
             });
            var orderLength = ctrl.order.length;
            _(ctrl.selectedWidgets).forEach(function (selectedWidget) {
                var index =  ctrl.existingOrder.indexOf(selectedWidget);
                if(index==-1){
                    ctrl.order[orderLength++] = selectedWidget;
                }
            });
        }
//find the existing order of widget layout
find the existing order of widget layout
find the existing order of widget layout
function findOrder(){
            ctrl.order=[];
            var counter = ctrl.existingOrder.length;
                _(ctrl.selectedWidgets).forEach(function (selectedWidget) {
                   var index =  ctrl.existingOrder.indexOf(selectedWidget);
                    if(index>-1){
                        ctrl.order[index] = selectedWidget;
                    }
             });
            var orderLength = ctrl.order.length;
            _(ctrl.selectedWidgets).forEach(function (selectedWidget) {
                var index =  ctrl.existingOrder.indexOf(selectedWidget);
                if(index==-1){
                    ctrl.order[orderLength++] = selectedWidget;
                }
            });
        }
function findOrder ( ) { ctrl . order = [ ] ; var counter = ctrl . existingOrder . length ; _ ( ctrl . selectedWidgets ) . forEach ( function ( selectedWidget ) { var index = ctrl . existingOrder . indexOf ( selectedWidget ) ; if ( index > - 1 ) { ctrl . order [ index ] = selectedWidget ; } } ) ; var orderLength = ctrl . order . length ; _ ( ctrl . selectedWidgets ) . forEach ( function ( selectedWidget ) { var index = ctrl . existingOrder . indexOf ( selectedWidget ) ; if ( index == - 1 ) { ctrl . order [ orderLength ++ ] = selectedWidget ; } } ) ; }
find the existing order of widget layout
find the existing order of widget layout