Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table in call_api_method needs to expand args #233

Closed
maxim-trokhimtchouk opened this issue Jan 7, 2023 · 1 comment
Closed

Table in call_api_method needs to expand args #233

maxim-trokhimtchouk opened this issue Jan 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@maxim-trokhimtchouk
Copy link

I think on this line the args when being passed to run_method need to be expanded.

self.run_method('call_api_method', name, args)

Otherwise call_api_method calls api with an array of single element which contains the actual args.

A simple way to replicate this issue is to call

filter = {
    'account': {
        'filterType': 'text',
        'type': 'equals',
        'filter': '1001'
    }
}
table.call_api_method('setFilterModel', filter)

Which then results in "AG Grid: setFilterModel() - no column found for colId: 0"

@falkoschindler falkoschindler self-assigned this Jan 7, 2023
@falkoschindler falkoschindler added the bug Something isn't working label Jan 7, 2023
@falkoschindler falkoschindler added this to the v1.1.0 milestone Jan 7, 2023
@falkoschindler
Copy link
Contributor

You are absolutely right. Thanks for pointing this out!

I fixed it in bf9a316.

Here is an example to try it out:

table = ui.table({
    'columnDefs': [{'field': 'name', 'filter': True}],
    'rowData': [{'name': 'Alice'}, {'name': 'Bob'}, {'name': 'Carol'}],
})
filter = {
    'name': {
        'filterType': 'text',
        'type': 'equals',
        'filter': 'Alice'
    }
}
ui.button('Filter', on_click=lambda: table.call_api_method('setFilterModel', filter))

falkoschindler added a commit that referenced this issue Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants