Comments (2)
@juliocast thank you for pointing that out. It seems the issue is coming from how we handle the sidebar on mobile. We basically move anything out of the navbar and add it to the sidebar for mobile. You can see the code in material-dashboard.js starting with line 117:
if(!mobile_menu_initialized){
$navbar = $('nav').find('.navbar-collapse').first().clone(true);
nav_content = '';
mobile_menu_content = '';
$navbar.children('ul').each(function(){
content_buff = $(this).html();
nav_content = nav_content + content_buff;
});
nav_content = '<ul class="nav nav-mobile-menu">' + nav_content + '</ul>';
$navbar_form = $('nav').find('.navbar-form').clone(true);
$sidebar_nav = $sidebar_wrapper.find(' > .nav');
// insert the navbar form before the sidebar list
$nav_content = $(nav_content);
$nav_content.insertBefore($sidebar_nav);
$navbar_form.insertBefore($nav_content);
$(".sidebar-wrapper .dropdown .dropdown-menu > li > a").click(function(event) {
event.stopPropagation();
});
mobile_menu_initialized = true;
Basically, we move the search using the clone, that means it is losing all the JS properties. Maybe you can add the clone(true,true)
as presented here: https://stackoverflow.com/questions/9549643/jquery-clone-not-cloning-event-bindings-even-with-on
I will do some further checks with my colleague @dragosct10 and come back with a solution on Monday/Tuesday.
Keep in touch,
Alex
from material-dashboard.
Hi Alex!
Thank you very much for explaining. I could solve the issue but I may have overcomplicated it.
I added the mask setting in the file too and it solved the mask issue.
mobile_menu_initialized = true;
// Plate mask for search field
$('#plate-search-field').mask('SSS0000');
Now for the form handling what I did is the following:
// Form submit event listener and handler
document.addEventListener('submit', eventHandler);
function eventHandler(e) {
e.preventDefault();
let sourceFormId = e.srcElement.id;
if (sourceFormId === 'plate-search-form') {
let plate = e.target["0"].value;
searchPlate(plate);
}
}
I'm looking for submit events and checking the source element ID, this way I can have as many forms as I want and just treat them by their IDs.
One thing I wanted to point too is that there is one doubled menu item within the mobile view sidebar:
I understand that this happens because all of the desktop search menu is put within the sidebar.
I think I can hide the second one and give an "active" class to the first one, right?
Thank you very much!
from material-dashboard.
Related Issues (20)
- Dash HOT 2
- [Bug] Search does not work even if the search function is activated.
- [Bug] Template does not work HOT 1
- [Feature Request] Documentation Datatable AJAX/fetch Request HOT 1
- php version for material blog pro for laravel HOT 1
- php version for material blog pro for laravel HOT 1
- i use Material Dashboard 2 - v3.0.2 but do'nt support RTL ?? HOT 1
- outdated version on npmjs HOT 1
- [Bug] btn-secondary non-uniform behaviour HOT 3
- [Bug] Navbar UI broken in mobile devices. HOT 2
- [Bug] Notification dropdown box-shadow HOT 3
- Idea shows there are errors in material-dashboard.css file HOT 1
- Hi Team, I have a question. I am a beginner Developer and I want use your theme in my code. I want to sell my code on codecanyon after install your theme, If my code approve on codecanyon, I will buy you premimum themes. So can I use it or not? HOT 1
- [Feature Request] A question HOT 1
- [Bug] Wrong instalation manual and not working template
- When will there be a BS 5.3.2 version and free from Gulp HOT 1
- [Bug] simple-datatables labels customization
- ERROR 404 Not Found The requested URL was not found on this server IN REAL VPS HOT 1
- Sidebar hiding without a toggle button on screens < lg HOT 2
- [Feature Request] I want to clone for use it for the Ride app.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-dashboard.