Wednesday, March 10, 2021

Custom filter button to show metadata filter on entity list

 Below jquery is to add custom filter button to show and hide the metadata filter in entity list.


var btncount = 0;
$(".entitylist.entity-grid").on("loaded", function (e) {
e.preventDefault();
if(btncount == 0){
$(this).children(".view-toolbar").append
('<button id="filterbtn" style="font-size:23px ;background-color:#FDFEFE;color:#2980B9;border:none; ">
<i class="fas fa-filter" style="font-size:25px;color:#2980B9"></i></button>');
btncount++
}
$('.view-loading, .message, .text-center').prop("style" , "display:none");
$(this).children(".view-grid").find("th").css("background-color", "#EBF5FB ");
$(this).children(".view-grid").find("tr:even").css("background-color", "#F4F6F6");
var count = 0;
$("#filterbtn").click(function(){
count++;
$('.col-md-3, .filter-vertical').show();
$('.col-md-3, .filter-vertial').prop("style","margin-left:-20px;")
$('.entity-grid, .entitylist').prop("style" , "margin-right:-35px;margin-left:-9px")
if(count % 2 == 0) {
// $('.col-md-3, .filter-vertical').hide();
// $('.entity-grid, .entitylist').prop("style" , "margin-right:-215px ; margin-left:33px")
} else {
}
})




No comments:

Post a Comment