Progress bars

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
Moh Youba
Veteran Member
Posts: 239
Joined: 2017-03-12 09:31

Progress bars

Post by Moh Youba » 2020-11-06 19:12

Hello

I am looking for the way to create a progress bar inside a column. Is that possible.
level_mark.jpg
level_mark.jpg (12.77 KiB) Viewed 4339 times
Thank you

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1709
Joined: 2018-04-01 10:12

Re: Progress bars

Post by pbottcher » 2020-11-06 20:04

Hi,

yes you can

add something like

Code: Select all

.addClass('progress-bar progress-bar-warning').attr({'role':"progressbar"}).css({"width": width}) 
to your table column where you calculate the width according to your definition.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Moh Youba
Veteran Member
Posts: 239
Joined: 2017-03-12 09:31

Re: Progress bars

Post by Moh Youba » 2020-11-07 12:00

Hello
Thank you for your reply, I am going to try it.

Regards,

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Progress bars

Post by SkayyHH » 2020-11-07 14:25

that is very cool. where exactly does the code have to be inserted?

User avatar
landinialejandro
AppGini Super Hero
AppGini Super Hero
Posts: 126
Joined: 2016-03-06 00:59
Location: Argentina
Contact:

Re: Progress bars

Post by landinialejandro » 2020-11-07 21:48

use this code inside your tablename-tv.js

Code: Select all

$j(function () {
    const max = 300;
    $j("td.tablename-fieldname").each(function () {
        var obj = $j(this);
        obj.css({position:"relative"});
        obj.children('a').css({position:"absolute","z-index":"1"});
        var value = obj.text();
        var rel = value / max;
        var w = obj.width();
        var h = obj.height();
        var $container = $j("<div/>", {
            "style": "border:1px solid #d3d3d3; position:absolute; top:3px; left:3px; z-index:0;"
        }).width(w).height(h);
        var $bar = $j("<div/>",{class:"bg-info"}).width(rel*100+"%").height("100%");
        obj.append($container.append($bar))
    });
});
Alejandro.
AppGini 5.98 - Linux OpenSuse Tumblewweed.

Some of my posts that may interest you:
:arrow: Landini Admin Template: Template for Appgini like AdminLTE
:arrow: Profile image plugin: add and changue image user profile
:arrow: Field editor in table view: Configurable fast edit fields in TV
:idea: my personal page

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Progress bars

Post by SkayyHH » 2020-11-08 07:33

Thank you so much. It works fantastic :-)

Kai

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Progress bars

Post by SkayyHH » 2020-11-08 13:18

Can you maybe tell me how I can adjust the height of the bar?

Thanks again, Kai

User avatar
landinialejandro
AppGini Super Hero
AppGini Super Hero
Posts: 126
Joined: 2016-03-06 00:59
Location: Argentina
Contact:

Re: Progress bars

Post by landinialejandro » 2020-11-08 14:39

SkayyHH wrote:
2020-11-08 13:18
Can you maybe tell me how I can adjust the height of the bar?

Thanks again, Kai
hi! this example get de height of container in
var h = obj.height();
there you can put your own value.
Alejandro.
AppGini 5.98 - Linux OpenSuse Tumblewweed.

Some of my posts that may interest you:
:arrow: Landini Admin Template: Template for Appgini like AdminLTE
:arrow: Profile image plugin: add and changue image user profile
:arrow: Field editor in table view: Configurable fast edit fields in TV
:idea: my personal page

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Progress bars

Post by SkayyHH » 2020-11-08 14:43

Hi, Thanks much!!

I tried this before.

But then the bar disappears completely. I guess I got that wrong. I have tried:

Code: Select all

       var h = obj.height (10px); and
       var h = obj.height (100%);
But unfortunately it doesn't work for me.

User avatar
landinialejandro
AppGini Super Hero
AppGini Super Hero
Posts: 126
Joined: 2016-03-06 00:59
Location: Argentina
Contact:

Re: Progress bars

Post by landinialejandro » 2020-11-08 14:58

SkayyHH wrote:
2020-11-08 14:43
Hi, Thanks much!!

I tried this before.

But then the bar disappears completely. I guess I got that wrong. I have tried:

Code: Select all

       var h = obj.height (10px); and
       var h = obj.height (100%);
But unfortunately it doesn't work for me.
the obj.height() function only return the container object define in var obj = $j(this);
only put a value
var h = "20px";
or
var h = "100%";
in this case yo need to re-define :
top:3px; left:3px ---> top:0px; left:0px
the bar is floating inside the td container, if you exceed the height the view is bad. so, 100% and obj.height() must be the max value to be get. without change the td container.
Alejandro.
AppGini 5.98 - Linux OpenSuse Tumblewweed.

Some of my posts that may interest you:
:arrow: Landini Admin Template: Template for Appgini like AdminLTE
:arrow: Profile image plugin: add and changue image user profile
:arrow: Field editor in table view: Configurable fast edit fields in TV
:idea: my personal page

Moh Youba
Veteran Member
Posts: 239
Joined: 2017-03-12 09:31

Re: Progress bars

Post by Moh Youba » 2020-11-08 20:20

Hello

Thank you very much, works as a charm for me
progress_bar.jpg
progress_bar.jpg (35.51 KiB) Viewed 4210 times
Regards,

SkayyHH
Veteran Member
Posts: 481
Joined: 2015-04-27 21:18

Re: Progress bars

Post by SkayyHH » 2020-11-08 21:13

This is exactly what i was looking for. Thank you very much!

Kai

Post Reply