forked from mbk-lab/rui_orig
2
0
Fork 0

Added detailsView expand event

This commit is contained in:
anoshenko 2021-11-20 16:53:45 +03:00
parent 36e6d0a389
commit 76ff9a38fb
4 changed files with 18 additions and 2 deletions

View File

@ -1362,3 +1362,7 @@ function setTitleColor(color) {
meta.setAttribute('content', color);
document.getElementsByTagName('head')[0].appendChild(meta);
}
function detailsEvent(element) {
sendMessage("details-open{session=" + sessionID + ",id=" + element.id + ",open=" + (element.open ? "1}" : "0}"));
}

View File

@ -128,6 +128,7 @@ func (detailsView *detailsViewData) htmlTag() string {
func (detailsView *detailsViewData) htmlProperties(self View, buffer *strings.Builder) {
detailsView.viewsContainerData.htmlProperties(self, buffer)
buffer.WriteString(` ontoggle="detailsEvent(this)"`)
if IsDetailsExpanded(detailsView, "") {
buffer.WriteString(` open`)
}
@ -151,6 +152,17 @@ func (detailsView *detailsViewData) htmlSubviews(self View, buffer *strings.Buil
detailsView.viewsContainerData.htmlSubviews(self, buffer)
}
func (detailsView *detailsViewData) handleCommand(self View, command string, data DataObject) bool {
if command == "details-open" {
if n, ok := dataIntProperty(data, "open"); ok {
detailsView.properties[Expanded] = (n != 0)
detailsView.propertyChangedEvent(Expanded)
}
return true
}
return detailsView.viewsContainerData.handleCommand(self, command, data)
}
// GetDetailsSummary returns a value of the Summary property of DetailsView.
// If the second argument (subviewID) is "" then a value from the first argument (view) is returned.
func GetDetailsSummary(view View, subviewID string) View {

View File

@ -312,10 +312,11 @@ func gridCellSizes(properties Properties, tag string, session Session) []SizeUni
return []SizeUnit{}
}
/*
func (gridLayout *gridLayoutData) cssStyle(self View, builder cssBuilder) {
gridLayout.viewsContainerData.cssStyle(self, builder)
// TODO
}
*/
// GetCellVerticalAlign returns the vertical align of a GridLayout cell content: TopAlign (0), BottomAlign (1), CenterAlign (2), StretchAlign (3)
// If the second argument (subviewID) is "" then a value from the first argument (view) is returned.

View File

@ -12,7 +12,6 @@ type TextView interface {
type textViewData struct {
viewData
// TODO textShadow
}
// NewTextView create new TextView object and return it