I've defined a list of Bootstrap column Values that allows the editor to define column width as a rendering parameter.
This is done by having a folder of Sitecore items and when I set the drop link to point at that folder I therefore get a drop down with numbers 1>12 for the editor to select.
I'm looking to obtain the field value of the droplink (labelled "Setting Value") but I am only receiving the GUID of the selected value how do I cast this to an item to be able to obtain its field values.
Thanks in advance
compiledClass += "col-md-" + GetProperty("Column Width Medium Device");
#{
var widthParameter = RenderingContext.Current.Rendering.Parameters["Width"];
var selectedWidthItemId = new Sitecore.Data.ID(widthParameter);
var widthItem = Sitecore.Context.Database.GetItem(selectedWidthItemId);
var widthValue = widthItem["Width value"];
var compiledClass = "";
compiledClass += "col-md-" + widthValue;
}
<div>
CompiledClass is: #compiledClass
</div>
Example assumes that your rendering parameters template contains 'Width' droplink field. And items within folder (source for droplink field) have 'Width value' field.
Related
With a query I have 3 values that I would like to process further. With the LOV, I only get a return value. Or you can use a plug-in, I've read.
How can I transfer the values from column 1 to text field 1, column 2 to text field 2 and column 3 to text field 3 by clicking on any row in an interactive grid?
I currently have a dynamic action stored in the interactive grid - when you "click".
With "True" I have selected the action "Set value" and as Set Type "Dialog Return Item". Unfortunately, it doesn't work that way.
I am not yet very fit in dealing with APEX and I hope your help.
Marja
add three page items page_item1, page_item2 and page_item1
You can create DA on the interactive grid on event selection change
Event
and action execute JavaScript code
JavaScript code
then write this code
var model = this.data.model;
for ( i = 0; i < this.data.selectedRecords.length; i++ ) {
$s("page_item1", $v("page_item1") += model.getValue( this.data.selectedRecords[i], "COLUMN1"));
$s("page_item2", $v("page_item2") += model.getValue( this.data.selectedRecords[i], "COLUMN2"));
$s("page_item3", $v("page_item3") += model.getValue( this.data.selectedRecords[i], "COLUMN3"));
}
`
I have a shuttle list that, depending on the selection of a previous form, may have between one and seven items. Is there any way for me to automatically move the entry to the right hand pane if there is only a single selection, just for the sake of long term optimization and user friendliness?
You can add a default Value to your shuttle item
SELECT YOUR_COLUMN_ID
FROM T0000_YOUR_TABLE
WHERE FILTER_COLUMN_ID = :P_FILTER_ITEM_PREV_FORM
GROUP BY YOUR_COLUMN_ID
HAVING COUNT(*) = 1
If there are more than 1 entries for your filter item the statement will return nothing, if there is exactly 1 entry the entry will be returned and set for your shuttle item
I like sim0n's answer. But here's another that uses JavaScript (you can choose which is best for your use case).
Create a Dynamic Action. Set Name to Page loaded and Event to Page Load.
Select the Action created by default. Set Action to Execute JavaScript Code, then enter the following code in Code.
var itemId = 'P1_ITEM_NAME';
var $opts = $('#' + itemId + ' select:eq(0) > option');
if ($opts.length === 1) {
$s(itemId, $opts.val());
}
Don't forget to change the name of the item to match the one on your page.
When the page loads, the JavaScript will check to see how many options are in the select element on the left. If there's just one, it will set the value of the item using the value to the value of the single option.
I want to display a link in a data grid, only when a certain condition is met for that record. I also want that link to be dynamic, based on the data in the data grid. Lastly, the data grid is linked to a header record displayed above the data grid region.
Create a hidden field that will be used for the Link Text. Column Name = HIDDEN_LINK_TEXT. Type = Hidden. This field will have a source type of SQL Expression. Q in this example query represents the data grid's source select statement. Parenthesis are required in the SQL Expression text box for the hidden field.
(SELECT '[Static link text]' FROM TABLE B WHERE B.RECORD_ID =
Q.RECORD_ID AND B.FIELD_1 = Q.FIELD_1 AND B.FIELD_2 = Q.FIELD_2)
Create a displayed field for the link. Column Name = DISPLAYED_LINK Type = Link.
Link Text should reference the hidden field we created in step 1. Link Text = &"HIDDEN_LINK_TEXT". Include the ampersand and double quotes.
Set the link target to what your target page. Include any variables or "Set Items" which you want to set when linking to the page.
I have an interactive report apex5.0 which contains several fields.
Would like to disable 'edit' pencil option link where payment_date & code is populated.
Link is to be enabled only where payment_date & code is null.
Disable the edit button for a particular row, based on a specific value in its column.
For ex. If a grid has 3 columns A,B,C and if B contains "Apple", and '01-jan-17', the edit button for that row must be disabled.
What are the different options to do this kind of functionality in apex5.0, enable & disable "EDIT" based on certain criteria?
You could also add a case statement to your report's query.
E.g.
(Case when [some logic] then
--display link
'<img src="#IMAGE_PREFIX#menu/pencil16x16.gif" alt="" />'
End) as col_link
The above example will only display a link if the case statement is met. The link will point to page 47 and we will pass the query's Id column to page 47's item P47_ID
In order to treat this new column as a link you must change the "display as text" property to "standard report column"; you can achieve this when editing the report attributes.
One way is to use JavaScript on page load:
Let's asume that first column is with ID and used to show edit link. Second column is your product name like Apple. Just disable click on this element(cell with ID) or change link, img etc.
var table = $(".a-IRR-table tbody");
table.find('tr').each(function (i, el) {
var $tds = $(this).find('td'),
productId = $tds.eq(0).text(), //first column with ID and edit link
product = $tds.eq(1).text(), //second column
Quantity = $tds.eq(2).text(); //third column
if (product == 'Apple'){
$tds.eq(0).click(false);
$tds.eq(0).replaceWith('');
}
});
Thanks to this answer for JavaScript: Loop Through Each HTML Table Column and Get the Data using jQuery
EDIT:
To hide value based on your Query use CASE. For example:
SELECT
CASE
WHEN B = 'Apple' THEN
'<img src="#IMAGE_PREFIX#edit.gif" alt="">'
ELSE ''
END edit_link,
A,B,C
FROM TABLE_NAME
Click on column edit_link and make it of type Link
Choose your target to edit page
For link text select #EDIT_LINK#
Escape special characters must be set to NO
On Report Atributes set **Link Column** to **Exclude Link Column** (you have custom link column so don't display original link)
*Check your online workspace, page 3*
how to refresh combobox items in vb .net
If you're talking about a comboBox on a WinForm that's been assigned to a list of objects using the datasource property, I found that you must nullify the datasource setting and re-assign it every time your list changes.
i.e.
attendanceDataFiles.DataSource = Nothing
attendanceDataFiles.DataSource = myFileList.files
attendanceDataFiles.DisplayMember = "displayName"
attendanceDataFiles.ValueMember = "fileName"
This is another way to refresh combo box items if your combo box's content is from MySql Database. You can customize your results in the query.
comboboxname.Items.clear() 'empty combo box content first
query = "select code, description from tbl_mode_of_payment where cat = 'LICENSE'" 'mysql query that retrieves payment code and its description based on category
cmd = New MySqlCommand(query, con)
reader = cmd.ExecuteReader()
While reader.Read
comboboxname.Items.Add(reader.GetString("code") + " - " + reader.GetString("description")) 'add results into the combo box
End While
con.Close()
Textbox1.Item.Clear()
then
call.item_tb()