Comments (3)
I'm not sure I can help you, because I don't know this react component. But I'm wondering why do you use:
react(data) { getState, changeState ->
form of react
function call, because you don't use the reference it returns (and the whole idea of this is to access react component internal state from kvision component, see: https://kvision.gitbook.io/kvision-guide/4.-integrating-with-javascript-libraries/using-react-components#advanced-components). Perhaps simplyfing the code and dropping getState
, changeState
calls will help you?
from kvision.
When I don't use this form of react the PREV, NEXT and OnslectDate don't work at all even once. That's why I think its to do with the Kvision/KotlinJS side of state management rather than the the library. Let me keep digging. Will update here if I find something.
By the way I was following this example from you. https://slack-chats.kotlinlang.org/t/515741/is-there-any-calendar-widget-i-could-use-that-could-be-prese
from kvision.
I have managed by keeping the schedulerData viewModel inside redux state then refreshing it during the PREV and NEXT schudeler functions. Below is the final code for SchedulerView.kt
SchedulerView.kt
package com.digitres.pmis.modules.scheduling
import com.digitres.pmis.modules.coreProject.activities.redux.ActivitiesActions
import com.digitres.pmis.modules.scheduling.models.SchedulerData
import com.digitres.pmis.redux.appStore
import io.kvision.core.Container
import io.kvision.core.Position
import io.kvision.html.div
import io.kvision.react.react
import io.kvision.require
import io.kvision.state.bind
import io.kvision.utils.px
import react.ComponentClass
import react.PropsWithChildren
external interface BigSchedulerProps : PropsWithChildren {
var schedulerData: SchedulerData
var prevClick: (scheduleData: SchedulerData)-> Unit
var nextClick: (scheduleData: SchedulerData)-> Unit
var onViewChange: (scheduleData: SchedulerData, view : dynamic) -> Unit
var onSelectDate: (scheduleData: SchedulerData, date: String) -> Unit
var eventItemClick: (scheduleData: SchedulerData, event : dynamic) -> Unit
}
val Scheduler: ComponentClass<BigSchedulerProps> = require("react-big-schedule").Scheduler
val ViewType = require("react-big-schedule").ViewType
fun Container.schedulerView() {
div().bind(appStore) {appState ->
position = Position.RELATIVE
paddingBottom = 100.px
val data:SchedulerData = appState.activities.schedulerData!!
val events = data.events
react {
Scheduler {
schedulerData = data
prevClick = { schedulerData ->
schedulerData.prev()
schedulerData.setEvents(events)
appStore.dispatch(ActivitiesActions.SetSchedulerData(schedulerData))
}
nextClick = { schedulerData ->
schedulerData.next()
schedulerData.setEvents(events)
appStore.dispatch(ActivitiesActions.SetSchedulerData(schedulerData))
}
onSelectDate = { schedulerData, date ->
schedulerData.setDate(date)
schedulerData.setEvents(events)
appStore.dispatch(ActivitiesActions.SetSchedulerData(schedulerData))
}
onViewChange = { schedulerData , view ->
schedulerData.setViewType(view.viewType, showAgenda = view.showAgenda, isEventPerspective = view.isEventPerspective)
schedulerData.setEvents(events)
}
eventItemClick = { _, event ->
console.log("Event clicked")
console.log(event)
}
}
}
}
}
from kvision.
Related Issues (20)
- overrides of `SimplePanel.AddAll` call refresh outside of a `singleRender` wrapper. HOT 1
- Allow KVService to have arguments with GET HOT 6
- Allow modifying response headers for Spring Boot and Micronaut apps HOT 1
- remove id parameter on get requests HOT 1
- Can't get data from Tabulator.RowComponent HOT 2
- Expandable/collapsible fieldset or panel HOT 2
- How to attch files using the Richtext Component HOT 7
- duplicated different word in kvision docs HOT 1
- did you consider to integrate kvision with ktor client? HOT 5
- can't make tabulator selectable with kvision v7.4.4 HOT 2
- My tabulator not selecting data HOT 5
- How to add more than one bottomCalc rows? HOT 2
- kvision gradle plugin not works well with Spring-Web-Flux HOT 4
- DropDown - call method instead of loading a route HOT 2
- Page loader how to. HOT 4
- Gantt and Calendar view of tasks HOT 7
- Make Alert Button Text Customizable HOT 1
- Incorrect checkbox size HOT 1
- Issue with 8.0.0-RC HOT 10
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 kvision.