how to create a Richfaces/JSF Dynamic Accordion? - dynamic

I want to create a dynamic Accordion, My usecase is like, On every click of a Action button I want to add 1 Accordion Item.
I am using JSF 2.0 and Richfaces 4.1.0 Final
Pls help me guys.

You would need to maintain a list of items in your managed bean. Then you could use a4j:repeat to iterate over this list in your jsf page and create a rich:accordionItem for each of element in the list. The action method for the button could add items to the list on the bean.

Related

sitefinity view cshtml accordion list

I am returning a list object within a list object and wanted to have the sub list in accordion list. Do I need to do this in JS or jquery? Or is this something within sitefinity controls that will be faster and better to use?
I do something like this
https://github.com/sitefinitysteve/RandomSiteControlsMVC/blob/master/RandomSiteControlsMVC/MVC/Views/DocumentTree/Simple.cshtml
(Try here https://rscdemo.sitefinitysteve.com/components/document-treelist)
If you have bootstrap on there, just add the collapse attributes to your elements
https://getbootstrap.com/docs/4.3/components/collapse/

yii2 dynamic-form do not create kartik Select2 events

I created a dynamic form using Yii2 dynamic-form that contains kartik Select2 widget which has select2:select in pluginEvents property.
The dynamic form create normally the fields with their attributes. However, the jquery event are not created.
I solved the problem by registering select2 event using kvListenEvent().
I placed the registration on afterInsert() yii2-dynamic-form event.

Creating view elements in VM using aurelia

Is what I am trying to do in this gist possible?
https://gist.run/?id=bea803b05ad8d5b5e3e0afd59bb8dbb1
In app.html, I'm trying to use a repeat.for to create a custom element called button-row
In app.js, I'm creating two button row instances which I then place into a button row array so that I can use the repeat.for to iterate over it and create the button rows on the app.html view.
In button-row.html, I have a repeat.for to create the buttons using the btns array and setting the name of the button.
In button-row.js, I have two properties. label is the label for the button row and btns is the array of all the button names I want to create.
Sorry if this is a noob question, I have only been working with web development and aurelia for about a month.
Instantiating the ButtonRow objects yourself won't work. Aurelia instantiates the instances. you'll need to use the binding system to pass in the information to the custom element. I updated your gist here: https://gist.run/?id=6ec71143f566571960b7a182d4d98ed4
Also, you should refrain from abbreviating words like "Button" let your tooling save you the keystrokes, while making your code more readable :-)

Make button text A/B testable - Sitecore MVC

I have an MVC/angularJS page with a button, the button needs to call code to process the current page and proceed to the next step in the application, but they want the button text to be a/b testable with different variations. I'm new to Sitecore so am struggling to know the best way of doing things.
I thought of having a simple text component/template which just has a single line text property, but if I add that to the page template then it doesn't seem a/b testable because when you click on the test option it asks you to select content. Whereas the content was text they entered as part of the page template.
The only way I know of making a/b testable content so that they can click on the page in page editor and choose to select content / add test variation. I wouldn't add the button to the placeholder as it needs to call specific angular code and always be there, but should I be adding a placeholder where the text is? It seems like overkill to have to define a placeholder there, define a rendering, create a partial view, define placeholder settings to limit it to the simple text component, and then hope they don't try adding multiple items to the placeholder.
I would make a separate template (ie with the text field for your button) to represent your form, then either create the two test variation items as children of your page, or maybe place them in a shared components folder outside of your 'home' node.
EDIT
In order to move your form component into a new A/B testable component you would need to create a new Sublayout in Sitecore, then create a new ascx control for the sublayout. In the Page_Load handler of this control, you would use the following code to retrieve the datasource of the sublayout:
//assume you have a button on your usercontrol called btnSubmit
//assume your template has a single-line text field called 'SubmitButtonText'
Guid dataSourceId;
Sitecore.Data.Items.Item dataSource;
if (Guid.TryParse(sublayout.DataSource, out dataSourceId))
{
dataSource = Sitecore.Context.Database.GetItem(new ID(dataSourceId));
btnSubmit.Text = dataSource["SubmitButtonText"];
}
So I created a new template which just had a single line of text as a field, and added a content item in a shared data node.
In my partial view:
#model Digital.Models.SimpleTextItem
<button ....>
<span class="hidden-xs">#Model.SimpleText_Value<br></span>
</button>
In my main page - I was trying to statically bind it so that they could only change content rather than add new controls to the placeholder, but that only worked if I specified the datasource in this page.
Using a rendering, and in the page layout adding the rendering to the placeholder with a specified data source:
#Html.Sitecore().Placeholder("PremiumQuoteApplyNowPlaceHolder")
Not sure if it was the best approach but it achieves what I need it to.
A/B testing could be applied only to controls(XSLT renderings, sublayouts, action controller renderings, view renderings). If you want to make A/B testing only for button then you should create additional control for it as you did.
Technical details for MVC: A/B testing is applied on mvc.customizeRendering pipeline where rendering arguments are processed. This pipeline operates on renderings level. It means that you are not able to create A/B testing for particular field(button) without your own customization.

Is there a way to refresh the list in an object dropdown using new query conditions ?

Using the object dropdown component I want to change the query and display a new list of items. Is that possible once the component has been created ?
http://developer.rallydev.com/help/object-dropdown
The best way to do this is to destroy the dropdown and recreate it again. Only a few of the AppSDK 1.0 components can reload their own data.
The ComboBoxes in the new App SDK 2.0 can be refreshed by calling load on its underlying store again (passing new filters, context, etc.)