how can i hide teh side bar in user if i disable the sidebar it will hide but left empty space instead of showing full width
finally after alot of research i came up with this script that not only hides the sidebar but also toggle the screen to full width and you can also remove some other fields as per requirments
frappe.listview_settings['doctype'] = {
onload: function(listview) {
if (!frappe.user.has_role('Administrator')) {
// Check if the sidebar toggle button exists
if ($('.sidebar-toggle-btn').length) {
// Trigger a click on the sidebar toggle button by default when the list view loads
$('.sidebar-toggle-btn').click();
// Remove the sidebar toggle button after clicking it
$('.sidebar-toggle-btn').remove();
$('.filter-selector').remove();
$('.menu-btn-group').remove();
$('.list-liked-by-me').remove();
$('.use.like-icon').remove();
}}
},
refresh: function(listview) {
if (!frappe.user.has_role('Administrator')) {
// Check if the sidebar toggle button exists again on refresh
if ($('.sidebar-toggle-btn').length) {
// Trigger a click on the sidebar toggle button by default when the list view is refreshed
$('.sidebar-toggle-btn').click();
// Remove the sidebar toggle button after clicking it
$('.sidebar-toggle-btn').remove();
$('.filter-selector').remove();
$('.menu-btn-group').remove();
}
}}
};
all roles except administor will not be able to see sidebar i also hide the filters and some other buttons you can edit as per your requirments