Comments (3)
It's working.
I removed the
document.addEventListener('DOMContentLoaded', () => {
});
from bladewind.
@resujentoezequiel I just added a JS function to the helper.js
file for this. Will be available in the next update but you can follow the steps below to have it working for you now.
- Add the function below to your project_root > public > vendor > bladewind > js > helpers.js
/**
* Set the value of a datepicker
* @return {void}
* @param {string} el_name - name of the input field to update
* @param {string} date - new value to set
*/
var setDatepickerValue = (el_name, date) => {
let newValue = date;
let input = domEl(`.${el_name}`);
if (!input) {
console.error(`No datepicker found with the name ${el_name}`);
return;
}
if (!input._x_model) {
console.error(`Alpine.js component not found for element ${el_name}`);
return;
}
input._x_model.set(date);
}
- Define any datepicker but make sure to give it a name
<x-bladewind::datepicker name="invoice_date" />
- Set the value of the datepicker via Javascript
document.addEventListener('DOMContentLoaded', () => {
setDatepickerValue('invoice_date', '2020-10-10');
});
The function expects the DOM content to have fully loaded to work. Ideally the DOM content should have fully loaded when you decide to call the function later on in your page but if you are testing with console.log
, you will need to use the event listener as I have done in point 3.
Please let me know if this worked for you.
from bladewind.
Awesome
from bladewind.
Related Issues (20)
- Required manual select components do not expand HOT 3
- Introduce default global configurations
- Modify the default button design
- Implement global configuration for components
- Unify colours used throughout components
- DATE PICKER HOT 7
- Icons don't display when using dot syntax HOT 4
- Form fields should respect <fieldset disabled> HOT 6
- Ampersand problem HOT 1
- disabled input and select HOT 1
- table component should have a scroll bar when too many rows HOT 5
- table component should use selected value HOT 1
- Select component - doesn't show selected value when readonly HOT 1
- Ampersand issue on INPUT Component
- Multiselect is broken since 2.6.5 HOT 1
- Validation not recognizing empty string when containing a space character HOT 1
- Minor squirks around the select component HOT 5
- input / textarea components don't respect readonly=false but select components do HOT 10
- Textarea toolbar not sending through value on form submission HOT 1
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 bladewind.