I have a view that with row-style set to "fields". Rather than theme the individual rows the normal way -- i.e. with style, row, and field templates -- I would like to extract certain information from each row, bundle up the extracted information as a json object, and then pass the json object to a script. The script will then render all the row-data.
I created a custom template, views-view-unformatted--myview.tpl.php with the following code:
<?php
$rowdata = array()
foreach ($rows as $key => $row) {
dsm ("row $key: "); dsm ($row);
$rowdata[$key] = dostuff($row);
}
?>
Unfortunately, I discovered that $row is no longer an object (which is what I need). It has already been rendered as an html string.
How do I tell views "please do not render the individual rows. I need access to the row data"
Thanks
Instead of using the style output template, you should use the row style output template. So your template file should be something like views-view-fields--your-view.tpl.php. Just look under the "Row style out" heading in Theming information" for the template name that you should use. In that template you will get the $row raw object.
I solved my problem by creating a views plugin. The approach is similar to what is described here http://groups.drupal.org/node/10129, in the section "Writing Views 2 Style and Row Plugins". I created a style plugin (but not a row plugin), and in the style definition I set 'uses row plugin' to false. I was then able to access the row data from within my style template. This allowed me to bundle up all my rows as json objects.
Related
I'm using python-docx to populate a word template that I have
The problem is that, I want to apply a particular style to a table I have
The table exists already
and I'm just extending it like this:
document = Document(path_to_my_docx)
table = document.tables[0]
row = table.add_row()
row.cells[0].text = "amrouna "
But when I add the row, it outputs this
the row containing amrouna is the row I added
I read in the python docx documentation, that styles won't apply unless they already exist in the document
which is the case here, isn't it ? because my table is already styled before I even load/modify it
Does anyone know how to either:
keep the style from changing when adding a row
Apply the same style to the table once everything is finished
If you replace the text of the cell object, it will override any styling applied to the table/row/cell/etc. What I found out after much struggle w/ something similar, is that you have to replace the text of the run within the paragraph, within the cell.
row.cells[0].paragraphs[0].runs[0].text = "amrouna "
This will preserve the styling from my limited experience... Hopefully it works for you as well.
Is it possible to force the user to select only one value from a filter ?
For a radio button filter as below, is it possible to remove the buttons all & none and make sure that only one Choice is selected ?
you cannot change the existing filter features or functionality without developing a custom extension for a new filter control.
that said, you can certainly emulate a filter using what's called a Property Control and a Data Limiting Expression. for single selection, you're stuck with either a Dropdown control or a Listbox (single select) control.
you would need to...
create a Text Area Visualization on the page somewhere
insert a Listbox or Dropdown Property Control into the Text Area Visualization
create a Document Property with the same data type as your filter column and associate it to the Property Control. you can set this to Unique Values in Column or write in your own Fixed values.
open the Properties dialog on the visualization you'd like to filter and navigate to the Data page
scroll down to Limit Data Using Expression and use an expression like [MyFilterColumn] = "${MyDocumentProperty}" (quotes are required for string values; if numeric then omit quotes)
Please add this CSS in the HTML page of the spotifre to remove all and none
.ColumnFilter .sf-element-filter-item:last-of-type { display:none; }
.ColumnFilter .sf-element-filter-item:first-of-type { display:none; }
Another way to force the users to select one option is to add a Show/Hide in the visualization like this: Hide if UniqueCount([Field]) is greater than 1
In TIBCO SPOTFIRE 7.5 I have a problem to set a document property with values selected in a checkbox: I have to use "OR" clause between 2 checkbox filter (it works always in "AND") so I want to set 2 document properties with checked values (2 checkbox) and use them in a limit expression.
Someone can help me?
Tnx
I will list two possible answers here, that differ in complexity. Which solution to use depends on how strong your requirements are on what UI control you can use.
Option 1 - Use Property Control
Add two property controls to a text area to set the document properties that will be used to limit data. Each property control will be set up to select values from a column in your data, for instance like this with the Film example data:
With two property controls as the one above, add a data limit expression to the visualization (Visualization properties -> Data -> Limit data using expression). Set expression like this:
[Actor] = "${Actor}" OR [Actress] = "${Actress}"
Here I've used the column [Actor] to match the value of the document property Actor or the column [Actress] to match the value of document property Actress.
Option 2 - Use JavaScript
If you really need the UI to be a checkbox, then there is no Spotfire Control to handle that. If the choices you need to allow the user to make is static, then this option is fairly straightforward. If you need the option to be based on the data, then it takes more work.
Let's start with the static case. In a textarea, add an input field and then modify the html to something similar to this:
<label><input type="checkbox" value="check1"> Checkbox1</label><br>
<label><input type="checkbox" value="check2"> Checkbox2</label><br>
<label><input type="checkbox" value="check3"> Checkbox3</label><br>
<div id='mySpotfireControl' style='display:none'>
<SpotfireControl id="344f7da2bc5d4baca88c7e76cb7d429b" />
</div>
Also add a javascript to the text area, similar to this:
$("input[type='checkbox']").change(function(){
var jsValue = $(this).val();
$('#mySpotfireControl input').val(jsValue).blur()
})
This will move the value from the checkbox into the Spotfire Document Property. From there, you can add a limiting expression same as when using solution 1 above.
If you need to generate the set of checkboxes that are available, then you need to generate the html for the text area dynamically. You can do this by writing an IronPython script that inspects the current data, and creates the html for the text area. This IronPython script would need to be invoced somehow, if you want it fully automatic you can trigger it from a data function that runs when the analysis is opened.
Need some help with Gravity forms. I need to have a field, that is a merge of values ,that user has previously selected.
So, if a user has selected 3 different fields wth values of 1)XYY, 2)YYX,3)YYZ I do not need a sum, just a plain merge, in form of XYY.YYX.YYZ, or anything like that.
Could that be acomplised with some merging tags, or dynamically population?
Thanks
Of course;
You should create two different forms.
Collect data with field1-field2-field3, they can be single line text, number, date or anything. In the advanced tab of field settings, write a parameter name for each one, like field1-field2-field3.
In the second form create a single line text, in the advanced tab of field settings check "dynamically populate field" and write your parameters like field1.field2.field3.
In form1 settings->confirmations->redirect URL line, write your form2 page url where you added form2. Select "Pass field data via query string" and add your parameters like field1={fieldname:1}&field2={fieldname:2}&field3={fieldname:3}
When you submit form1, your form2->single line text field will capture the parameters as you wish.
This is possible with Gravity Forms Populate Anything by...
Add whatever type of field you'd like to use to capture the combined.
Set the Default Value to the merge tags of your 3 fields: #{Field A:1}.#{Field B:2}.#{Field C:3}.
That's it.
Edit: Updated screenshot for Gravity Forms 2.5 and updated merge tags to use the # to make them "live".
I have a custom publishing page layout I have created. The content type behind the page layout has a lookup column pointing to a document library where I store images. Basically, the pages I am creating from the layout are 'articles' and I have an associated image with each.
As you can probably guess by now, I want to display the lookup image on the page. However, I cannot for the life of me figure out how to do this. I have been inserting columns into the page layout via controls, but I'm not sure how to format it to look at the source document behind the lookup column. I am wondering if it is possible somehow through controls, and if not this way, if it can be done through modifying the XSL of a webpart. My last option which I don't want to use but I know it would work is a workflow (on new item creation, copy Name (FileLeafRef) into a hidden single line text field I coult utilize).
Does anyone know how to format a lookup column to display Name (FileLeafRef)?
Help is greatly appreciated!
-Josh