Select last Item in long List Selector - windows-phone-8

![![>I want to add this Tile in the end of the Long list selector Item so I can navigate to new Add >page (I should pass the Table Id as a parameter so I can insert my order in the selected Table ). >the selected change work only when my Tile is a Long List Selector Item. ??
Thanks]1

You can set the last item as the selected one when you initialize the ItemsSource property of the long list selector:
LongListSelector.ItemsSource = myList;
LongListSelector.SelectedItem = myList.Last();
LongListSelector.ScrollTo(myList.Last()); //if you want to scroll to that element as well
Hope this example will help you.

Related

MS-Access Form - Populate Input Box based on multiple List Boxes

I have a form with multiple list boxes that all pull from the same table. I want a separate input box to populate a field from the table based on a selection from either list box. So if I select an item in MyListBox1 that record will display in the input box, but then if I select an item in MyListBox2, the input box will display that record instead.
I have a general idea how to do this with 1 list box based on the .selected of the MyListBox object. However, I'm trying to get an idea if its possible for based an Input box off the selected object's selection? Or last selected object if that makes sense.
This seems like a really counter-intuitive interface, but assuming I've correctly understood what you are looking to achieve, I believe you would need to use an unbound Text Box which would be populated via the After Update event of each List Box.
For example, given two List Boxes respectively called List1 & List2, and a Textbox called Text1, the following simplistic event handler could be defined for each list box to populate the Text Box accordingly:
Private Sub List1_AfterUpdate()
Text1 = List1
End Sub
Private Sub List2_AfterUpdate()
Text1 = List2
End Sub
Yielding the following daft behaviour:

Select row checkbox on each item select in Primefaces datatable cellEditor

When I select an item in datatable with editMode="cell" (e.g. inputText , selectOneMenu) only that specific component is selected which is normal, but I want to select to whole row when I click on it, not just the component.
my problem is kind of UI related, there are specific areas on the row when you click on, the whole row gets selected, but when you click on the component in the row, only that component gets selected not the row and if you're collecting the object in backing bean, you don't have that row object.
You can use the clientId from AjaxBehaviorEvent to get the index of the data.
ClientId is look like this
form:feeTbl:0:j_idt49
0 is the index. To get the index, you need to split it.

separating data in an array for display in Flex

I'm new to flex/flash builder, i need to read in data from a text document, then slice it into pieces i set out in my custom class.
all of this so far worked
var theCustomer:Customer=new Customer(name,address,phoneNo,comment,custNo);
custArray.addItem(theCustomer);
So now what i want to do is display only the name from each entry of the array into a combobox - and then on close it will display all the details into a list box
If i just bind the custArray to the combobox it displays name:address:phoneNo:comment:custNo as i set it out, but like i said i want only the name so how do i separate the name from each Customer entry in the array ??
Any help you be awesome and thanks in advance !!!
If I'm understanding your question correctly, I think you want to set the labelField property on the combobox. This specifies the field in the source data objects to use in the label.
<s:ComboBox dataProvider="{custArray}" labelField="name"/>
The ComboBox has several ways to specify what it should use as the "label" for each item in the dataProvider:
By default, if the elements in the dataProvider has a property named label, and that property contains a String it will display that value.
ComboBox has a labelField property that you can use to tell it where to find the "label" for each item. In your case, you could set the labelField to "name"
ComboBox has a labelFunction property that allows you to use a function (that you write) to specify what text should be displayed for each item.
I suggest using the the labelField, as that seems the most straight forward in this case:
<s:ComboBox dataProvider="{custArray}" labelField="name" />

Accessing ListBox selected item via UiApp.getActiveApplication().getElementByID()

Currently I am using UiService to create a form and I uses ListBox, from what I understand to pass a value via handler will be something like e.parameter.[Name of ListBox] to access the selected item.
Does anyone know is it possible to use like app.getElementById([Name of ListBox]) to access the selected item. The reason I am using this method is because my list of ListBox-es are dynamic.
I spent some time looking for this answer as well, but finally I tried one idea and it worked.
You can use e.parameter as an array so you can these two will give the same:
e.parameter.LIST_BOX_NAME
and
e.parameter['LIST_BOX_NAME']
So in the second sample any dynamic list box ID can be used. I use same handler for all added dropdown list and have this code to check what dropdown was changed and what value it has now:
if (e.parameter[e.parameter.source] == 'a'){
To change the content of the listBox you can use app.getElementById('ID of the listBox'), from there you can clear() and addItems again but you cannot read the listItems.
When I need to do this I usually store the list of items somewhere else, in a place that I can read anytime, for example the list of items can be stored as a string in the listBox tag itself so I have all items at hand to repopulate the listBox after I have clear it.

JComboBox as CellRenderer does not set the correct value

I'm using a JComboBox as CellRenderer in my JTable.
Everything works fine the JComboBox displays the correct item for the corresponding row.
The problem I am currently working on is that when I choose a new value in the JComboBox (for example row 9) the value is set correctly, but when I try to change the value in the next row, the JComboBox (for example in row 10) automatically sets the value of the row before.
I created a DropDownCellRenderer class which extends JComboBox and implements TableCellRenderer, I thought that is enough, but it seems that the DropDownCellRenderer-object is the same for every row.
table.getColumnModel().getColumn( 3 ).setCellRenderer( new DropDownCellRenderer() );
table.getColumnModel().getColumn( 3 ).setCellEditor( new DefaultCellEditor( new DropDownCellRenderer() ) );
How can I avoid that every row uses the same object?
Looked at your renderer's source code.
I don't think you have to look up the Product by name. The value passed to you is the Product, which is coming from your table model (if it is implemented correctly). Just set the value as selected item and it should work.
To make renderer behave correctly, change its foreground and background colors according to isSelected parameter. The code should look like:
if (isSelected) {
setForeground(table.getSelectionForeground());
super.setBackground(table.getSelectionBackground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
Make your initial array of values an argument of the constructor. This will transform your renderer into universal combobox renderer.
It sounds like you're saving and displaying values within the combo box itself, not from the model of the table. When you set a value and save a combobox value you need to update the model