DetailList selecting first item on load - office-ui-fabric

I have a Detaillist implemented which loads 1000 items. How do I make the first item to be selected after loading?

You call this._selection.setKeySelected("KEY_VALUE_OF_FIRST_ITEM", true, true)
Selection component Doc

Related

Visibility of expanding last view in the expandable RecyclerView

I want the things in the last expandable item to be fully visible when it is clicked,Now what is happening means when I click on last item it expands down, but I manually need to scroll up again to see the the things inside the expanded item.How can the last expandable item be fully visible.
I am using Recyclerview.
I have found the solution which I wanted, I used
recyclerView.smoothScrollToPosition(selectedPosition);
after setting the adapter. So now the things in the last expandable item is fully visible when it is clicked.
Just a supplementary:
If you use h6ah4i/advrecyclerview, you can use the following code snippet:
#Override
public boolean onHookGroupExpand(int groupPosition, boolean fromUser) {
// NOTE21: collapse all other groups when one item expand.
mExpMgr.collapseAll();
// NOTE21: Visibility of expanding last view in the expandable recyclerview
if (groupPosition == getGroupCount() - 1) {
mRecyclerView.smoothScrollToPosition(groupPosition + getChildCount(groupPosition));
}
return true;
}

LongListMultiSelector programatic selection

In windows phone I have a LongListMultiSelector control that has multi selection made by the user and the selection is saved in a file.
Then If the user tries to load his selection from the file loads fine and selected items are selected again using IsSelected property.
My question is that Why only visible items are checked while other selected items that are outside the view are unchecked ,How can I make them checked also?
LonglistMultiSelector doesn't load all of the items at startup, loads items that are needed instead (see ItemRealized and ItemUnrealized events). Since some of the items that you want to select are not assigned to UI, you can't select them. You can workaround this by scrolling to that item.
I've used the following code to select all items in a LongListMultiSelector.
foreach (ViewModels.ItemViewModel item in longListMultiSelector.ItemsSource)
{
LongListMultiSelectorItem container = longListMultiSelector.ContainerFromItem(item) as LongListMultiSelectorItem;
if (container == null)
{
// item has't been assigned to UI
longListMultiSelector.ScrollTo(item);
container = longListMultiSelector.ContainerFromItem(item) as LongListMultiSelectorItem;
}
container.IsSelected = true;
}

Accessing RadListBox Items in Code-Behind

I have the following RadListBox:
<telerik:RadListBox ID="AttachmentsRadListBox" CheckBoxes ="true" runat="server" />
It is located in a RadWindow, therefore I am populating it through the following code which is only called when RadWidnow becomes visible:
AttachmentsRadListBox.DataSource = AttachDT
AttachmentsRadListBox.DataTextField = "DocumentPath"
AttachmentsRadListBox.DataValueField = "DocumentID"
AttachmentsRadListBox.DataBind()
For Each item As RadListBoxItem In AttachmentsRadListBox.Items
item.Checked = True
Next
So far so good, the RadListBox is populated and all the items are checked.
Now, there is a Save button on the RadWindow when pressed before closing the window I am trying to read the checked items in the AttachmentsRadListBox (Since the user might have changed the status of the checked items). But every effort on reading the items has failed, for example on the Save button click I have the following:
Dim test As Integer = AttachmentsRadListBox.Items.Count // THIS IS ZERO
For Each item As RadListBoxItem In AttachmentsRadListBox.Items // THERE ARE NO ITEMS
If Not item.Checked Then
Dim DocumentIDToDelete As Integer = item.Value
End If
Next
Why is that the last piece of code does not behave as I hope? The AttachmentsRadListBox is not being bounded again through the postback. The only time that it is bounded is when the RadWindow appears. Then the Save button on the RadWindow obviously creates a postback but I don't understand why AttachmentsRadListBox contains no item at that point.
Since you create the AttachmentsRadListBox dynamically, do you recreate it on subsequent postbacks? It is, in the end, a server control, so you need to make sure it is recreated, because otherwise ASP will destroy it upon a subsequent postback.
To see how you can access controls in the ContentTemplate of a RadWindow you can also examine this article: http://www.telerik.com/help/aspnet-ajax/window-controls-container.html.

Dynamic menu button items in TinyMCE

I have a custom menubutton in my tinyMCE editor that uses specific HTML elements elsewhere on the page as the menu items. I use a jQuery selector to get the list of elements and then add one each as a menu item:
c.onRenderMenu.add(function(c,m) {
m.add({ title: 'Pick One:', 'class': 'mceMenuItemTitle' }).setDisabled(1);
$('span[data-menuitem]').each(function() {
var val = $(this).html();
m.add({
title: $(this).attr("data-menuitem"),
onclick: function () { tinyMCE.activeEditor.execCommand('mceInsertContent', false, val) }
});
});
});
My problem is that this only happens once when the button is first clicked and the menu is first rendered. The HTML elements on the current page will change occasionally based on user clicks and some AJAX, so I need this selector code to run each time the menu is rendered to make sure the menu is fully up-to-date. Is that possible?
Failing that, is it possible to dynamically update the control from the end of my AJAX call elsewhere in the page? I'm not sure how to access the menu item and to update it. Something using tinyMCE.activeEditor.controlManager...?
Thanks!
I found a solution to this problem, though I'm not sure it's the best path.
It doesn't look like I can make tinyMCE re-render the menu, so instead I've added some code at the end of my AJAX call: after it has updated the DOM then it manually updates the tinymce drop menu.
The menu object is accessible using:
tinyMCE.activeEditor.controlManager.get('editor_mybutton_menu')
where mybutton is the name of my custom control. My quick-and-dirty solution is to call removeAll() on this menu object (to remove all the current menu items) and then to re-execute my selector code to find the matching elements in the (new) DOM and to add the menu items back based on the new state.
It seems to work just fine, though tweaks & ideas are always welcome!

Showing progress bar on top of page while Winjs.ui.listview is loading

How to show the indeterminate progress bar on top of the page while Winjs.UI.ListView fetching the data. Is there any built in feature to show the progress in Winjs?
Let's say the method where you fetch your daya is getData().
function getData(){
var progress = document.createElement("progress");
document.getElementById("someDiv").appendChild(progress); //we have created and appended an undetermined progress bar.
//do the data fetching, and, when it's over and ítems have been asigned to the ListView remove the progress element from the div.
}
Otherwise, in HTML:
<progress></progress>