nnmware / devoops

DevOOPS Bootstrap 3 Admin theme
GNU General Public License v3.0
852 stars 416 forks source link

Left side menu actives the dashboard after Refreshing though my current page is different #23

Closed mohamedmusthafac closed 9 years ago

mohamedmusthafac commented 9 years ago

For Example: If i am in the page "Data Tables"

-Tables ----Data Tables

The left side menu gets active and it highlights the "Data Tables" Page But if i refresh the "Data Tables" page it should highlight the same "Data Tables" Page in left side menu after Refreshing, but it is highlighting the Dashboard Page

Any way i corrected this issue in my project by getting the current link in jquery and adding the active class in css using jquery for Left Side Menu

briansol commented 9 years ago

Yes, I've noticed this as well. There is no onLoader that reads-in the hash value and sets the active class on the menu accordingly. Could you share your code bit? I'm about to do the same but am finding i can't do it as dyanmically as I want (I changed my loaders to be a mainprocess.php?DO=linkitem) style instead of html, but sometimes the title is Link Item, not Linkitem so matching it is of course difficult.

mohamedmusthafac commented 9 years ago

Yaaa here is my code

inside devoops.js Add this code

var ajax_url = location.hash.replace(/^#/, '');
  if (ajax_url.length < 1) {
    ajax_url = 'ajax/dashboard.html';
  }
 $('.main-menu li a[href$="' + ajax_url + '"]').ready(function() {
    $('.main-menu li a[href$="' + ajax_url + '"]').addClass('active-parent active');
    $('.dropdown:has(li:has(a.active)) > a').addClass('active-parent active');
    $('.dropdown:has(li:has(a.active)) > ul').css("display", "block");
});

LoadAjaxContent(ajax_url);
$('.main-menu').on('click', 'a', function(e) {

    $('.main-menu li a[href$="' + ajax_url + '"]').ready(function() {
        $('.dropdown:has(li:has(a.active))').removeClass('active-parent active');
    });

......... etc remaining coding continues

and this works fine for me

briansol commented 9 years ago

Thanks, this seems to work perfect :+1: )

mohamedmusthafac commented 9 years ago

You are welcome briansol, if there is any issue let me know it

devoopsme commented 9 years ago

Thank you for idea! Fixed in 359bff3818a74251a10e4c62118fecd771fc0d34

mohamedmusthafac commented 9 years ago

You are welcome deevoops

Manikanta1023 commented 7 years ago

Hi,

var ajax_url = location.hash.replace(/^#/, ''); if (ajax_url.length < 1) { ajax_url = 'ajax/dashboard.html'; } i have used this ajax replace firefox working good, in chrome not working [ NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///D:/fastlane_erp/30-Aug/erp/ajax/charts_xcharts.html'.] this is my problem in google chrome please help me.

nnmware commented 7 years ago

Hi. If I right understanding and remember - only FF can work with Ajax and local files. For Chrome and IE you need upload project to remove server.

Manikanta1023 commented 7 years ago

Tq nnmware..