JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Gantt › horizontal scroll with drag
- This topic has 6 replies, 2 voices, and was last updated 1 year, 11 months ago by svetoslav_borislavov.
-
AuthorPosts
-
December 14, 2022 at 11:30 am #104101Guillermo RubioParticipant
Hello,
My clients needs to horizontal scroll to see the end of a task, but when there’s many task, they havo to go all the way down scroll where they think is the end of the task and go up to the task, and repeat if not showing the end.
Is there a way to click outside a task and move/drag the whole gantt, or anything i can use to prevent this problem?
Thank you
December 15, 2022 at 7:36 am #104110svetoslav_borislavovParticipantHi,
Could you please, explain further the problem as I did not understand it.
The horizontal and the vertical scrollbars are independent, I do not understand why are you scrolling this way.
Are you using some auto-height?You can also send us a demo here or to support@jqwidgets.com
We are waiting for your reply!
Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/- This reply was modified 1 year, 11 months ago by svetoslav_borislavov.
- This reply was modified 1 year, 11 months ago by svetoslav_borislavov.
December 15, 2022 at 4:44 pm #104115Guillermo RubioParticipantHello ill try to explain better:
Lets say i want to see where the orange bar ends:
So i need to scroll to the right, but i have many task so i have to go down all the way to find the horizontal scroll bar
scroll to the right
and go up again to see if i see the end of the orange bar (in this case i dont so ill have to do it again)
- This reply was modified 1 year, 11 months ago by Guillermo Rubio.
- This reply was modified 1 year, 11 months ago by Guillermo Rubio.
December 16, 2022 at 1:45 pm #104118svetoslav_borislavovParticipantHi,
What styles are you applying, because this horizontal scroll is not the same as our default?
As you can see in this demo with many tasks: https://www.htmlelements.com/react/demos/gantt/many-tasks/The horizontal scroll is under the tasks and also under the table.
You can also send us a demo here or to support@jqwidets.com
Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/December 20, 2022 at 4:30 pm #104140Guillermo RubioParticipantHi, i was using
.smart-gantt-chart {
height: fit-conten
}but anyway i changed it and it solved more or less the problem, i also figured out how to do what i wanted (click and drag to the left/right the gantt) ill let u the code here in case u need it:
in useEffect:
const gantt = document.getElementsByClassName(‘smart-timeline-content’)[0]
if (gantt) {gantt.addEventListener(‘mousedown’, (e) => {
document.body.style.cursor = ‘grabbing’
document.addEventListener(‘mousemove’, mouseMoveHandler)
document.addEventListener(‘mouseup’, mouseUpHandler)
}
}functions definition:
const mouseMoveHandler = function (e: MouseEvent) {
if (!dateRef.current) {//dateRef is a useref that changes when the gantt event onResizeStart and comes back to null onResizeEnd, this way i prevent scrolling when resizing
if (xRef.current == null) xRef.current = e.pageX //xRef is a useRef to store last pageX
if (xRef.current != e.pageX) {
const scrollbar = document.querySelectorAll(
‘[smart-id=”horizontalScrollBar”]’
)[1]
const currentScroll = parseInt(scrollbar.getAttribute(‘value’)) || 0
const max = parseInt(scrollbar.getAttribute(‘max’))
let diff = (xRef.current – e.pageX) * (max / 700) //increase decrease 700 to make it slower/faster
if (diff > 0) diff = Math.ceil(diff)
else diff = Math.floor(diff)
if (diff != 0) {
const scroll =
currentScroll + diff < 0
? 0
: currentScroll + diff > max
? max
: currentScroll + diff
scrollbar.setAttribute(‘value’, scroll.toString())
scrollRef.current = scroll.toString()
}
xRef.current = e.pageX
}
}
}
const mouseUpHandler = function (e) {
document.body.style.cursor = ”
document.removeEventListener(‘mousemove’, mouseMoveHandler)
document.removeEventListener(‘mouseup’, mouseUpHandler)
xRef.current = null
}I think it would be a nice add on the gantt
I have another problem now but ill put it in another ticket as i think is different
Thank u very much- This reply was modified 1 year, 11 months ago by Guillermo Rubio.
December 21, 2022 at 6:52 am #104144svetoslav_borislavovParticipantHi,
I suggest you send a demo to us here: support@jqwidgets.com
This is not a good workaround. I have tried to reproduce the problem, but I couldn’tWe are waiting for you!
Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/December 21, 2022 at 8:31 am #104147svetoslav_borislavovParticipantHi,
Another problem may be the height: fit-content
It should be a number or percentage
Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.