I would like to have a template with a table which has first column with auto incremented number. When you hit tab in the last cell in the last row a new row is created (as it is now in Confluence's tables) and in first column number is incremented automatically.
I was looking for some macros (but I don't want to buy anything) and found only this one: https://marketplace.atlassian.com/plugins/org.swift.confluence.tablesorter which can't be used as a separate one without buying other plugins.
I was thinking about making my own macro and I would be grateful for pointing me direction where to start (I read confluence guide about macros). Do I need to use Velocity for that?
We have Confluence 4.3.6 installed
I haven't worked with velocity for a while and don't have a project around to test, but i think this should work for you:
#set($rowNumber = 0)
<table>
#foreach( $product in $allProducts )
<tr>
<td>$rowNumber</td>
<!-- your stuff goes here -->
<tr>
#set($rowNumber = $rowNumber +1)
#end
</table>
Related
I have a question about data display. Here's a piece of code (component):
<th scope="col">Visiblity</th>
<td v-if="page.visible !== null && page.visible===1">Yes</td>
<td v-else>No</td>
As a result I receive Yes / No.
Everything works correctly on the local server (xampp), however, after placing the project on an external server, the condition does not work. Although I have a value of 1 everywhere in the database, it shows me a value of 0 everywhere.
Can anyone tell me what the problem is?
Edit:
hmm
I made a simple project in Laravel + Vue
I have several elements in my design. For example, draggable, visible-draggable etc. Works, but in list.blade.php I have a table with data from the database. One column brings up visibility with two value options - 1 or 0. After the record is created and saved, everything is fine. In DB I have 0, 1 value, but Vue show all like a "No". I should have "Yes / No" values in list.blade.php.
I will add that I didn't use npm run production before placing the project on the server, but all components work, only v-if, v-else not.
What I need is to have every second row of a table to have a different background colour. I have successfully created my method that can be called from the rml document and returns the hex colour. What I need is a way on rml side to set the background-colour attribute of the tr tag to the return value of my method. How can this be done ? I have been using the official documentation and looking specifically at the chapter 11 Conditional formatting but I do not see anything. Essentially what I want to do it the following:
<tr style="background-colour: [[_get_colour(index)]];" />
_get_colour will return a string that will contain the hex value of a colour
Edit: As it turns out the docIf RML tags that are used for conditional formatting are not implemented in openerp v7 according to this and I have to resort to a different solution.
Can't test this at the moment, but here's an idea that might work:
Make two <tr> for each iteration (1 for each style). In one of them, check if the index is even or removeParentNode('tr'), in the other, check if the index is odd or removeParentNode('tr'). This way only one or the other table row will display on each iteration, but not both.
Example (untested):
<tr style="style1">[[ (index%2 == 0 and display.content) or removeParentNode('tr')]]</tr>
<tr style="style2">[[ (index%2 != 0 and display.content) or removeParentNode('tr')]]</tr>
I found an example of that problem being solved in an rml in the system. I ended up resolving the issue with the following:
<tr>[[ setTag('tr','tr',{'style': 'Move_Line_Contect_Assign_State_background' if picking.move_lines.index(move_lines) % 2 else 'Move_Line_Contect_Assign_State'}) ]]
Situation:
I have a pandas dataframe which I convert into an html table via df.to_html(). I then add the DataTables class to the table. This DataTables-table has the following columns:
ID | X | Y | Val |...More columns...| Selection_Criteria |...More columns...
The values in Selection_Criteria can be either 1 or 0. I know that with:
$('#ProductList').DataTable( {
...
"fnInitComplete": function(oSettings, json) { $('#ProductList tbody tr:eq(0)').click(); }
});
(Source: http://code.datatables.net/forums/discussion/38171/automatic-select-of-the-first-row-on-reload)
..it is theoretically possible to select the first row. (In reality, I have not been able to simulate a click for the first row.)
But my question goes more towards: How do I automatically pre-select ALL rows where the value is 1 in Selection_Criteria? What is the best approach? Should this be done client/server side?
In pandas the term "select"(ing) means to screen out that which was not selected for. I know that in a table on a web page, selected can mean being highlighted to stand out from the others. There are a couple of ways you can do this on the server side. You could display two tables, one for each state of Selection_Criteria. This would save you the hassle of trying to select individual rows out of a table in the first place (which would be done with Javascript, not Pandas). While pandas has the ability to add a class to the resulting html, the class is applied to the element.
If you are using jquery you are going to use these pieces. as you haven't put example data I can't be exact.
replace x in the next line with the number of columns the Selection_Criteria=1 is across the table
$( "tr td:nth-child(x):contains('1')" ).addClass('selected');
There are solutions on the backend using beautifulsoup and css selectors, or lxml.etree with xpath selectors. But jquery is going to be the most concise with this problem.
#Aliester. Thank you for the pointer!
This helped me find the solution to my own question. What I did:
1.) Identify row index that I want to select when the table loads.
2.) Pass the index to js.
3.) Loop over the indices and apply the following command to each index entry:
table.row(':eq('+hit_index_row+')').select();
So I am using the API to select each individual row. This works for me and hopefully could be helpful to others as well. It may be a bit hacky, so more elegant suggestions are welcome!
You can do this by providing a function for the "rowCallback" option when initializing the DataTable. https://datatables.net/reference/option/rowCallback
Also it is generally better to use the API methods to select rows instead of just changing the class. I found that the DataTable + Select libraries keep an internal collection of selected row indexes (just current page if serverside processing is on) instead of using the class to resolve selected items.
So while the display will look right, if you just change the class, if you rely on any of the API methods to get selected items later on there will be issues. Additionally just changing the class on the row will not fire any of the "select" events on the table so you can't rely on those either.
I need to add a non-breaking space ( ) between the required field label and the *, to hopefully prevent the *'s from wrapping onto a new line (e.g. for the first field, I need the * to stay on the same line with at least one of the words in the label).
Can anyone help me find this in the Yii core? I've looked for a while.
Here's another example of where this is happening:
You need to override $afterRequiredLabel in CHtml.
The default value is currently set to ' <span class="required">*</span>'
You will want to change it to ' <span class="required">*</span>'
You could change the Yii core, but this is not advisable. Instead, you should extend CHtml and reference your child class moving forward.
Since clean 8.5.3 Domino has problem with localized numbers with space as thousand separators, I decided to switch to djCurrencyTextBox. But as don't want to display fractional part, I'm struggling with it too. Even on 9.0.1 test server.
If I create simple field using:
<xe:djCurrencyTextBox id="djCurrencyTextBox1" value="#{document1.currency}">
<xe:this.constraints>
<xe:djNumberConstraints fractional="false">
</xe:djNumberConstraints>
</xe:this.constraints>
</xe:djCurrencyTextBox>
It does not recognize any number entered. ( I get message that value is not valid even when I enter just 1)
When add it as dojo attribute directly, it works as expected
<xe:djCurrencyTextBox id = "djCurrencyTextBox1"
value ="#{document1.currency}" >
<xe:this.dojoAttributes>
<xp:dojoAttribute name ="data-dojo-props"
value ="constraints:{fractional:false}" >
</xp:dojoAttribute>
</xe:this.dojoAttributes>
</xe:djCurrencyTextBox >
Any ideas what can cause the issue?
This is a known issue that is not fixed in 9.0.1
Using the first example above, no matter what value you set on the fractional constraint (enable/disable/auto/true/false), the textbox only ever accepts a value with fractional part included (e.g. 567.89), which is incorrect for disable & false values. The second example works as expected with fractional set to true or false.
This is because, looking at the page source, the html output for the first example is:
<input dojoType="dijit.form.CurrencyTextBox" constraints="{"fractional":"false"}" id="view:_id1:djCurrencyTextBox1" name="view:_id1:djCurrencyTextBox1">
The """ parts should not be included in the constraints.
Whereas with the 2nd example, there is no such issue:
<input dojoType="dijit.form.CurrencyTextBox" data-dojo-props="constraints:{fractional:false}" id="view:_id1:djCurrencyTextBox2" name="view:_id1:djCurrencyTextBox2">
As this has not yet been fixed in 9.0.1, all you can do is utilise the workaround that you have posted for the time being.
UPDATE: The fix for this issue is in Release 9 of the v901 XPages Extension Library on OpenNTF