I have a remarks table in my template that does not always has an value.
Is it possible to hide this table if it's empty?
Hiding the table header is no problem using the following code;
{%if report_comment%}Remarks{%endif%}
Related
I'm creating a report with a basic table:
This table will print a Direct Transfer:
Fields are populated by simple drag & drop from the left pannel (dataset).
When printing the report, I can see a blank row in the header:
How can I remove that empty row? I didn't apply any spacing or anything to add a blank row...
EDIT:
The grouping part is by default, I didn't edit anything:
Based on #Alan Schofield comment I've checked if the dataset came with an empty row by painting the table rows in yellow and table header in blue.
Confirmed that there was an empty row in the dataset.
Then as a simple (not clean) solution I've added a conditional visibility to the table rows:
=IIF(Fields!ItemNo_TransShptLine.Value = "", True, False)
In my case, all rows will have an "Item No.", so if there's a row without it won't print:
Step 1: Collect requirements from the client.
Step 2: Complete the design part from the CSS team.
Step 3: Create Entity.
Step 4: You can access the Form template by logging into technical support.
Create a new form template with template code, template name.
Select the master type, and form type also fill in the required fields
What is outer Html?
Ans: An outer HTML defines the outer cover div of an HTML file.
What is Inner Html?
Ans: An Inner HTML defines the cover div which is looping for a field.
What is a Template list query?
Ans: The list query for saved data.
enter image description here
Section in Formtemplates
We can split the HTML file into multiple sections and the outer part (outer cover div) will keep in the outer HTML.
We can add fields by clicking Create fields
We can also add additional classes, styles, override names,s, etc in the create field.
We can add a formula with the fields
if you want to add functionality with a query we can write the query in the form of template functions
Step 1: Collect requirements from the client.
Step 2: Complete the design part from the CSS team.
Step 3: Create Entity.
Step 4: You can access the Form template by logging into technical support.
Create a new form template with template code, template name.
Select the master type, and form type also fill in the required fields
What is outer Html?
Ans: An outer HTML defines the outer cover div of an HTML file.
What is Inner Html?
Ans: An Inner HTML defines the cover div which is looping for a field.
What is a Template list query?
Ans: The list query for saved data.
enter image description here
Section in Formtemplates
We can split the HTML file into multiple sections and the outer part (outer cover div) will keep in the outer HTML.
We can add fields by clicking Create fields
We can also add additional classes, styles, override names,s, etc in the create field.
We can add a formula with the fields
if you want to add functionality with a query we can write the query in the form of template functions
I want to add a column with a hyperlink to my existing table which I created using djangotables2
I tried this but did not work for me.
I am able to add an extra column but the header name but the columns do not show anything in the cells. Could you please guide me on it?
Below is my code
class PDFColumn(tables.Column):
def render(self, value):
return format_html('PDF pdf link', value)
class MYTable(tables.Table): #this is my existing lass table on view page
PDF = PDFColumn()
Now able to see any data within the columns, only column appears with header name PDF
I'm having a problem with a template: I'm trying to display a form for changing a value, in which the user enters the current value in a textarea and the old value is kept inside a hidden field for auditing purposes. This value is generally some HTML, and when I render the page this HTML in the hidden field seems to get partially rendered: the value attribute of my hidden field gets closed by the first quotation marks inside the entered HTML, and the rest of the HTML spews out onto my page. I've tried using the escape decorator but that hasn't changed anything.
Firstly, a better solution might be to keep the audit value in a separate model field defined with editable=False. You can still perform checks against the value in a form's clean method:
def clean(self):
cleaned_data = super(SomeForm, self).clean()
if instance.the_audit_field == cleaned_data['the_editable_field']:
...raise a validation error?
You can also modify the value of the audit field from within the model's save method.
Secondly, assuming you must do it the way you are now, let me address the non-escaped value in your template. I assume you're using something like the following:
<textarea value="{{ form.the_audit_field.value }}"></textarea>
You should instead use the following:
<textarea>{{ form.the_audit_field.value }}</textarea>
Note, the value goes inside the textarea, instead of in the value attribute of it.
An even better way to do it is to simply allow Django to render the field for you like the following:
{{ form.the_audit_field }}
I need to disable (not hide) a single table row in a table with at least two rows. I've been searching for how to do it, but everything I've found tells me how to hide the row. I need to actually disable it so that the result is not submitted.
I'm using a template row and cloning when users add rows. On submit, the hidden template and the rows with actual data are all submitted. The database save fails because the hidden row doesn't pass validation.
<tr class="template" style="display:none">
<!-- This is the row to be copied and unhidden to add to the table -->
<td>company</td>
<td>department</td>
<td>line</td>
<td>account</td>
</tr>
It looks to me like you are going to duplicate the table row over and over again to create the table structure with javascript or something. Options:
You could remove the row from the DOM before submission or
jQuery('tr.template').remove();
you could select all the rows except it to submit
jQuery('table tr').not('tr.template').submit();
I personally do not think it is possible to have a table without rows, perhaps you mean you want to stylise your website without using a table?
If that is the case, then if your not already, set up a css file, with this you can edit and manipulate blocks for your website. ( I would post screenshots but my reputation isn't up yet ^-^ )