B4J Question [BANanoVuetifyAD3] Multi Select in a VueTable

Hi,
I can not make the multi Select in a VueTable work. It opens up ok with the correct items and I can click them but cannot get the correct value from _saveitem.
I always get the full item list and not the selected items.

@Mashiane do you have an example for how to use multi Select in a VueTable?

Best regards
/Christian
 
I got it to work in the end but I do not think I'm doing it in the easiest or in the correct way.
I can share my solution here tomorrow, I needed to change a bit in VueTable to make it work.
 
Upvote 0
I got it to work in the end but I do not think I'm doing it in the easiest or in the correct way.
I can share my solution here tomorrow, I needed to change a bit in VueTable to make it work.
This is how I made it work. In bananovuetifyad3 I changed the mulitselect line from this:
HTML:
<v-template v-slot:input><v-Select :Items="${nf.sourceTable}" :loading="props.item.loading" item-text="${nf.displayField}" ${sbConditionalColor} item-value="${nf.sourcefield}" clearable :value="strparse(props.item.${value})" :label="props.header.text" dense class="mt-2" outlined ${sbMultiple} ${sbThisEvent}></v-Select></v-template>
to this:
HTML:
<v-template v-slot:input><v-select :items="${nf.SourceTable}" ${sbConditionalColor} :value="strparse(props.item.${value})" :label="props.header.text" color="black" dense class="mt-2" filled outlined ${sbMultiple} ${sbThisEvent}></v-Select></v-template>

item-text and item-value seems to make things not work for me, loading part might work.
And then in b4j I added "_fileditems" as a list of all my options and for the preselected items then it needs to be a string which is "," separated.
Then when you get a _filed_Change (item As Map) then you need to handle the item as a keyed Map but for the values only and not the fields.
I did save these in a global value and at open and close then I use the global value.

All things are not in the code below just the important things.
For example the ThicknessList in the code can vary but the important thing is that you do not get the same item for open and close as in change and that is what you need to take care of.

B4X:
Sub Process_Globals
    Private thickness_list_str As String
End Sub

Sub Init
    Dim thickness_list As List = vuetify.NewList
    Dim thickness_str As String
    thickness_list.Initialize
    thickness_list = ThicknessList

    Dim first As Boolean = True
    For Each list_item As String In thickness_list
        If first Then
            thickness_str = list_item
        Else
            thickness_str = thickness_str & "," & list_item
        End If
        first = False
    Next
    select_row.Put("thickness_field", thickness_str)
    vuetify.SetData("thickness_fielditems", thickness_list)
End Sub

Private Sub VueTable_thickness_field_Change (item As Map)
    Dim thickness_list As List
    Dim thickness_change As String = ""
    For Each key As String In item.Keys
        thickness_list.Add(item.Get(key))
    Next
    thickness_list.Sort(True)
    Dim key_cnt As Int = 0
    For Each item_str As String In thickness_list
        key_cnt = key_cnt + 1
        thickness_change = thickness_change & item_str
        If (thickness_list.Size > key_cnt) Then
            thickness_change = thickness_change & ","
        End If
    Next
    thickness_list_str = thickness_change
End Sub

Private Sub VueTable_OpenItem (item As Map)
    thickness_list_str = item.Get("thickness_field")
End Sub

Private Sub VueTable_CloseItem (item As Map)
    item.Put("thickness_field", thickness_list_str)
End Sub

I hope this help to use the multiselect in a vuetable.

/Christian
 
Upvote 0
Top