Hello,
I wonder how i can use under my user macro, the value on a separate cell in the same row on which i did insert my custom macro within an existing confluence table ?
Thanks for help :)
Nicolas
Hello there!
That is an interesting project Nicolas. Fetching the values from within a Confluence table is possible, but by no means it is clean.
We will need to fetch the page value within your User Macro and work from there. Here we have another thread that tries to do exactly this, fetch the page body content within a user macro:
how to get a page content body via velocity in a user macro?
When we have the content, we will then need to identify the values that the macro needs. Another article in our Community might shed some light on how we can work with tables in our macros:
The Admin's tale - User Macro filtering a Confluence table
Another option would be to create tables within the macro itself and work from there:
Formatting html table via user macro
For short, your project is possible, but not really clean in the end. Looking forward to your reply Nicolas.
Hello Diego,
Thanks for your reply and for this very usefull threads.
I did change what i did plan to do and was able to build a full table with a user macro based on my needs.
However i am still looking to a solution to retrieve data from a "master table" based on the first column term selection, in order to build custom pages and separate data & structure for a bunch of pages ( which will be all macro ).
I was not able to make the javascript working on the example i did see :
## @noparams
#set ( $Long = $generalUtil.getSystemStartupTime() )
#set ( $pageId = 5997128 )
#set ( $page = $pageManager.getPage($pageId) )
#set ( $pageContent = $page.getBodyAsString() )
#set ( $searchterm = "check_totob" )
<div id="searchInput$paramFilterID">
$searchterm
</div>
<div id="tableFilter$paramFilterID">
$pageContent
</div>
<script type="text/javascript">
AJS.$("#searchInput$paramFilterID").keyup(function () {
var jqry = AJS.$
var rows = jqry("#tableFilter$paramFilterID tbody tr").hide();
var searchData = this.value;
if (searchData.length) {
var data = searchData.toLowerCase().split(" ");
jqry.each(data, function (search_idx, str) {
rows.filter(function(row) {
var col_to_filter = $paramColumnNumber;
if (col_to_filter>=0) {
var td_to_filter = $(this).children("td").eq(parseInt(col_to_filter));
return $(td_to_filter).text().toLowerCase().indexOf(data) >= 0;
} else {
return $(this).text().toLowerCase().indexOf(data) >= 0;
}
}).show();
});
} else {
rows.show();
}
});
</script>
rgds
Nicolas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.