TACTIC Open Source
Inject items into tableWdg - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Inject items into tableWdg (/showthread.php?tid=65)

Inject items into tableWdg - dankitchen - 01-10-2020

I am building an interface where I end up with a bunch of search keys (for the same search type)   and wonder if it is possible to take an empty tableWdg and drop the items into it.  I would assume it would likely be providing the widget with an array of search keys then refreshing the table?

I suppose one other potential way is to run a search on the table with a list of code values?

I am going to dig a bit an if I figure it out I will post my results if I do, just figured it was a topic worth discussing :-)

Seems I found something that works. You can pass in a "search_keys" option into the table as a comma-separated list.

RE: Inject items into tableWdg - listy - 01-11-2020

You can share Your solutions on the forum, so the Users can see useful things You did.

RE: Inject items into tableWdg - dankitchen - 01-13-2020

So in my case, I am using a table in a custom layout widget. On the surface the resulting xml needs to be someting like:

<element name="payments">
<display class="tactic.ui.panel.ViewPanelWdg">
<search_keys>COMMA SEPARATED SEARCH KYES HERE</search_keys>

but, if the search_keys option is empty it seems to tick off the table wdg so I had to not provide the option at all unless I had search keys. I am using python for this so in my html I have:

<element name="payments">
<display class="tactic.ui.panel.ViewPanelWdg">

Then for the python I have:

search_keys = kwargs.get("search_keys")
if search_keys:
search_keys_option = "<search_keys>%s</search_keys>" %search_keys
search_keys_option = ""

The ideas is that this is custom layout I am calling into a dashboard where I have a list of search keys I want to draw in a table, by packaging this up into its own custom layout, it was a clean way to pass in the list of search keys as a kwarg to the custom layout.

RE: Inject items into tableWdg - remkonoteboom - 01-16-2020

Yes, an empty option will treat it as if nothing is there. You could also use an expression.


where expression in python would be something like:

expression = "@SEARCH(lpc/payment['code','in','%s'])" % search_keys
# I believe the delimiter is a pipe

Note a few things:
1) In the filter, you can match to nothing
2) Use @SEARCH and not @SOBJECT as it is more efficient (maybe not so much in this case, but it is good practice)