When using objects for the items prop, you must associate item-text and item-value with existing properties on your objects. These values are defaulted to text and value and can be changed.
Sub LoadProjectType() 'IgnoreDeadCode
'declare class for manipulating data from database
Dim rsproject_types As BANanoMySQLE
rsproject_types.Initialize("projectmanager", "project_types", "", "")
'set the data model to be used
vuetify.SetDataModelMySQL(rsproject_types)
'set the master back-end
vuetify.SetBackEndMySQLE(rsproject_types)
'build query to select the records
'Define query and then execute it
Dim Qry As String = "SELECT id,name,color FROM project_types ORDER BY name"
rsproject_types.Result = BANano.Await(rsproject_types.ExecuteWait(Qry))
'assign result to the element
acproject_type.SetItems(page, rsproject_types.Result)
End Sub
Type mdlproject_types (id As String,name As String,color As String)
Type mdlproject_status (id As String,name As String,color As String)
Sub mounted 'ignoreDeadCode
'we want the records to load on mount
vuetify.Loading(True)
'load related data from other tables
BANano.Await(LoadProjectType)
BANano.Await(LoadProjectStatus)
BANano.Await(LoadAssignedTo)
dsprojects.SELECT_ALL
End Sub
Sub LoadProjectType() 'IgnoreDeadCode
'declare class for manipulating data from database
Dim rsproject_types As BANanoMySQLE
rsproject_types.Initialize("projectmanager", "project_types", "", "")
'set the data model to be used
vuetify.SetDataModelMySQL(rsproject_types)
'set the master back-end
vuetify.SetBackEndMySQLE(rsproject_types)
'build query to select the records
'Define query and then execute it
Dim Qry As String = "SELECT id,name,color FROM project_types ORDER BY name"
rsproject_types.Result = BANano.Await(rsproject_types.ExecuteWait(Qry))
'assign result to the element
acproject_type.SetItems(page, rsproject_types.Result)
'create reference table
mproject_types.Initialize
Do While rsproject_types.NextRow
Dim sid As String = rsproject_types.GetString("id")
Dim sname As String = rsproject_types.GetString("name")
Dim scolor As String = rsproject_types.GetString("color")
Dim foreignType As mdlproject_types
foreignType.Initialize
foreignType.id = sid
foreignType.name = sname
foreignType.color = scolor
mproject_types.put(sid, foreignType)
Loop
End Sub
'code to get the color for project_type
private Sub getproject_typecolor(item As Map) As String
'get the field name
Dim sproject_type As String = item.get("project_type")
'get the model
Dim foreignType As mdlproject_types = mproject_types.get(sproject_type)
'get the color
Dim scolor As String = foreignType.color
Return scolor
End Sub
'*****
'code to get the value for project_type
private Sub getproject_typevalue(item As Map) As String
'get the field name
Dim sproject_type As String = item.get("project_type")
'get the model
Dim foreignType As mdlproject_types = mproject_types.get(sproject_type)
'get the value
Dim sname As String = foreignType.name
Return sname
End Sub
macproject_type.put("ValueMethod", "getproject_typevalue()")
macproject_type.put("ColorMethod", "getproject_typecolor")
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?