Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Persist Sidebar State


Hey Guys,
How can one persist the sidebar state across pages? As soon as we go to a new page, the sidebar is expanded again.

Thanks in advance


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (6)


https://devs.keenthemes.com/question/persist-aside-menu-state-minimized-or-not-in-cookie
Buradaki konuyu inceleyebilirsiniz



Hi Michael,

Thanks to Murat Özcan for the link
https://devs.keenthemes.com/question/persist-aside-menu-state-minimized-or-not-in-cookie

Could you please edit in this file based on the above guide:
starterkit/resources/_keenthemes/src/metronic/demo1/js/layout/sidebar.js

Thanks



Great, thanks @Murat & @Faizal



Glad it works.

Thanks



Just a heads up for anyone that sees this in the future, be sure to add the relevant cookies into /app/Http/Middleware/EncryptCookies.php.

I added the following which were all coming up in the developer console:

protected $except = [
"sidebar_minimize_state",
"kt_aside_toggle_state",
"kt_aside_menu",
"data-kt-app-sidebar-minimize"
];


Not sure if you guys (KeenThemes) want to add the above by default on starterkit, but wouldnt be the worst idea along with any other cookies you may have by default?



Hello Michael,

Thank you for sharing your solution with the community. Your suggestion to add the relevant cookies to /app/Http/Middleware/EncryptCookies.php is definitely helpful for anyone who may encounter a similar issue in the future.

We appreciate your feedback and will take it into consideration for future updates. We always strive to provide the best possible experience for our users, and feedback like yours helps us to achieve that goal.

Thank you again for taking the time to share your solution, and please don't hesitate to reach out to us if you have any further questions or concerns.

Best regards


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(