Panel 0.12.6 cannot make param.MultiFileSelector behave like FileSelector

I would like to use param.MultiFileSelector.
I expect it be give the same result as the FileSelector widget
But I cannot get it worked:

import param
class MRecordData(param.Parameterized):
    params = {'file_pattern':'*.txt'}
    fvariable  = param.MultiFileSelector(path='./data') #, **params)
import panel as pn
files = pn.widgets.FileSelector('./data', file_pattern='*.txt')

base = MRecordData()
occupancy = pn.Row(MRecordData.param, files)

Don’t know what I’m missing
Any help would be great

Hi @trophime

The param.MultiFileSelector is mapped to pn.widgets.FileSelector but that does not mean it have the same functionality available to it. A way to do what you want is the following:

import param
import panel as pn

class MRecordData(pn.viewable.Viewer):
    fvariable = param.MultiFileSelector()

    def __panel__(self):
        return pn.widgets.FileSelector.from_param(
            self.param.fvariable, show_name=False, directory=".", file_pattern="*.txt"

files = pn.widgets.FileSelector(".", file_pattern="*.txt")

base = MRecordData()
occupancy = pn.panel(base)

Hope this helps.