jQuery UI Widgets › Forums › React › Doing custom increments for the jqxNumberInput control
Tagged: jqxNumberInput step
This topic contains 4 replies, has 2 voices, and was last updated by nepalmer 2 years, 8 months ago.
-
Author
-
Hi,
is it possible to do custom increment steps for the jqxNumberInput control? I’d like the jqxNumberInput to go up by the following steps, 1.00, 10, 100, 1000 when using the spinner buttons.
Thanks
Hi,
You may set the spin button step with the following property: spinButtonsStep
An example:
return (
<JqxNumberInput
ref={this.myNumberInput}
spinButtons={true}
spinButtonsStep={10}
/>
);Best regards,
Svetoslav BorislavovjQWidgets Team
https://www.jqwidgets.com/Hi,
Thanks for the response. I did find that property and it partially does what I want. But I’d like the increments to change in a different order than by say 10. I’d like to sequence to be 1,10,100,1000,10000.
Is that possible?
Thanks
Hi,
To achieve something similar, you can do this:
function App() {
const myNumberInput = useRef();
const listenerApplied = useRef(false);const [currentStep, setCurrentStep] = useState(1);
useEffect(() => {
if (myNumberInput.current && !listenerApplied.current) {
listenerApplied.current = true;document.querySelector(
${myNumberInput.current._componentSelector} .jqx-action-button)
?.addEventListener(‘click’, (e) => {
setCurrentStep(s => s * 10)
})
}
}, [])return (
<div className=”application”>
<JqxNumberInput
ref={myNumberInput}
spinButtons={true}
spinButtonsStep={currentStep}
/>
</div >
);}
Best regards,
Svetoslav BorislavovjQWidgets Team
https://www.jqwidgets.com/Thanks that works great
-
AuthorPosts
You must be logged in to reply to this topic.