Titanium Appcelerator Listview onItemLongclick alternative? - data-binding

DATABINDING
How can I assign events like onItemclick to Listview items but instead of it behaving like onClick" I want something like "onLongClick" or "onSwipe", is there any workaround to this?
<ListView id="userList" defaultItemTemplate="user" onItemclick="deleteProfile">
<Templates>
<ItemTemplate bindId="user" name="user">
<Label bindId="name" class="name"/>
</ItemTemplate>
</Templates>
<ListSection id="section" dataCollection="users">
<ListItem template="user" user:id="{id}" user:adresse="{adresse}" name:text="{author}"/>
</ListSection>
</ListView>

ListView doesn't have Longpress event. You'll need to switch to TableView instead to get that to work.

Related

Xamarin.Forms SwipeView OnClick Event Handler

I'm experimenting with the new SwipeView controls in Xamarin forms 4.4, and have been going through the FavFighters example (Code on Github) and think it's brilliant.
I'm able to add a Swipe right/left gesture as I wanted, but I can't find out how to add an OnClick event to an item in the list, in a Master/Detail type of project. I was hoping to use the swipe left/right actions for shortcuts, but want the user to click on the listed item to drill-into it further.
Is there a way of adding an OnClick (or an onSelected) event to the SwipeView items?
Yes you can definitely go with Xamarin.Forms.Effects which allows you implement different effects with native features.
You can refer this: https://github.com/mrxten/XamEffects it shows how to have tap effect, long tap effect, which will be helpful in your case [you can do that even without installing third party plugin].
Do you want to achieve the result like following GIF.
If you want to add the click event for your SwipeView. you just add the GestureRecognizers in your swipeView like following code.
<SwipeView>
<SwipeView.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</SwipeView.GestureRecognizers>
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem Text="Favorite"
BackgroundColor="LightGreen"
Invoked="SwipeItem_Invoked" />
<SwipeItem Text="Delete"
BackgroundColor="LightPink"
Invoked="SwipeItem_Invoked_1" />
</SwipeItems>
</SwipeView.LeftItems>
<!-- Content -->
<Grid HeightRequest="60"
WidthRequest="300"
BackgroundColor="LightGray">
<Label Text="Swipe right"
HorizontalOptions="Center"
VerticalOptions="Center" />
</Grid>
</SwipeView>
In the background code.
private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
Navigation.PushModalAsync(new Page1());
}

ASPxPopupControl clear all layout group

I want to clear all contents in all LayoutGroups.
So I use
<dx:ASPxPopupControl ID="AspxPopUPDeneme" runat="server" ClientInstanceName="AspxPopUPDeneme" ClientSideEvents-Closing="function(s,e){ASPxClientEdit.ClearEditorsInContainerById('form_clear');}">
<ContentCollection>
<dx:PopupControlContentControl>
<div id="form_clear">
<dx:ASPxFormLayout ID="ASPxFormLayoutDeneme" runat="server" ClientInstanceName="ASPxFormLayoutDeneme">
<Items>
<dx:TabbedLayoutGroup>
<Items>
<dx:LayoutGroup>....</dx:LayoutGroup>
<dx:LayoutGroup>....</dx:LayoutGroup>
</Items>
</dx:TabbedLayoutGroup>
</Items>
</dx:ASPxFormLayout>
</div>
But this method only clear active LayoutGroup when I closing the PopUp.
My problem as shown in this image
How can I solve this problem?
By default, ClearEditorsInContainerById clears all visible editors (i.e. in active tab) that belongs to a container group given by certain containerId. To include invisible editors on other tab, use 3-argument version of ClearEditorsInContainerById as shown below:
function clearAllOnClose(s, e)
{
ASPxClientEdit.ClearEditorsInContainerById('form_clear', null, true);
}
<dx:ASPxPopupControl ID="AspxPopUPDeneme" runat="server" ClientInstanceName="AspxPopUPDeneme"
ClientSideEvents-Closing="clearAllOnClose">
<ContentCollection>
<dx:PopupControlContentControl runat="server">
<div id="form_clear">
<dx:ASPxFormLayout ID="ASPxFormLayoutDeneme" runat="server" ClientInstanceName="ASPxFormLayoutDeneme">
<Items>
<dx:TabbedLayoutGroup>
<Items>
<dx:LayoutGroup>....</dx:LayoutGroup>
<dx:LayoutGroup>....</dx:LayoutGroup>
</Items>
</dx:TabbedLayoutGroup>
</Items>
</dx:ASPxFormLayout>
</div>
</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxPopupControl>
Setting true in third argument means that null values are assigned to all controls under form_clear div container, regardless of their visibility status.
Note from documentation:
If the validationGroup parameter is set to null, the method clears
all/visible (under the clearInvisibleEditors parameter value) editors
located within the specified container.
Reference:
DevExpress Documentation: ClearEditorsInContainerById

TextBox with Default value

I want to use a textbox that shows a text.
For example : Someone#example.com. When the user clicks on it, the textbox is cleared and ready for the user to type.
If you are working on newer browsers then you can use placeholder property which is new in HTML 5
<asp:TextBox ID="textBox1" runat="server" placeholder="Someone#exmaple.com"></asp:TextBox>
otherwise you can also use onfocus and onblur event to do this as described here
you can use this, is so easy
<input class="status" type="text" size="5" placeholder="started" />
placeholder show you the text you want
hope it helps you!
You can do the following:
Add textbox to your webpage.
Set the default text in the obj.Text property.
Add properties ( focus & blur events).
On focus event, check if the value = Someone#exmaple.com , then empty the text box.
On blur, check if the textbox is empty, then set the text : Someone#exmaple.com
Hope that helps
You can use like this
<TextBox ID="txtone" runat="server" tooltip="Enter comments"
onblur="if(this.value=='') this.value='Someone#exmaple.com';"
onfocus="if(this.value == 'Someone#exmaple.com') this.value='';"
Text="Someone#exmaple.com"></TextBox>
Try this for a server control:
<asp:TextBox ID="textBox1" runat="server" placeholder="Someone#exmaple.com"></asp:TextBox>
For an HTML control:
<input Type="Text" ID="textBox1" placeholder="Someone#exmaple.com" />
You can use this ajax if you want a cross browser compatible version.
<ajaxToolkit:TextBoxWatermarkExtender ID="EmailClear" runat="server" TargetControlID="EmailAddress" WatermarkText="Someone#example.com" />
You just have to add this under each field.

How to use combobox in devexpress aspxgridview

I am displaying my data in a devexpress gridview. One of the column is state value. When the grid is edited, I have to show the state in a combobox, so that the user could change the state by choosing a different state. Currently it is displayed in a textbox, since it is the default. Essentially when the user clicks the edit button, a combobox should be displayed as part of the edit controls, and the combobox should be populated with all possible states in the codebehind and the selected value should be the initial value on the grid. It is very easy do it in MS gridview. But I couldn't see any sample code for how to do it in the devexpress gridview.
Thanks
Use GridViewDataComboBoxColumn. Declare datasource and attach it to combo box column or populate it in code behind. This example contains both variants.
You can also take a look at DevExpress grid editing demos.
<dx:GridViewDataTextColumn FieldName="FieldName" VisibleIndex="4">
<EditItemTemplate>
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server" DataSourceID="newDataSource" >
</dx:ASPxComboBox>
</EditItemTemplate>
</dx:GridViewDataTextColumn>
You'll need to set the datasource so you'll get the list of values
If you don't have a data source and want to include the combo box items in your code, here's another way to create the column:
<dx:GridViewDataComboBoxColumn FieldName="QAAproval" VisibleIndex="11" Width="30px">
<PropertiesComboBox>`enter code here`
<Items>
<dx:ListEditItem Text="GENERIC" Value="GENERIC" />
<dx:ListEditItem Text="FAIR" Value="FAIR" />
<dx:ListEditItem Text="VSE" Value="VSE" />
<dx:ListEditItem Text="ECAV" Value="ECAV" />
<dx:ListEditItem Text="FMMDS" Value="FMMDS" />
<dx:ListEditItem Text="CLEAR" Value="CLEAR" />
</Items>
</PropertiesComboBox>
<CellStyle Font-Size="XX-Small">
</CellStyle>
</dx:GridViewDataComboBoxColumn>
Edit the GridView Template, and in the EditTemplate of the field, add the dropdownbox. It might come to look like this
<dx:GridViewDataTextColumn Caption="Field Name"
FieldName="FieldName" VisibleIndex="3">
<EditItemTemplate>
<cc1:DropDownList ID="DropDownList1" runat="server">
</cc1:DropDownList>
</EditItemTemplate>
</dx:GridViewDataTextColumn>
So when you edit that row, it will show the DDL
I have used the following code to have combo box in the aspxgridview.
I hope this example helps :
<dx:GridViewDataComboBoxColumn FieldName="DatabaseFieldName" Settings-FilterMode="DisplayText"
Width="3%" VisibleIndex="3" Visible="True" Caption="Priority" Settings-AutoFilterCondition="Contains"
HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center" CellStyle-HorizontalAlign="Center"
CellStyle-VerticalAlign="Top">
<PropertiesComboBox ValueType="System.String" DataSourceID="objDataSourceID"
Width="200px" Height="25px" TextField="TextFieldName" ValueField="ValueFieldName"
IncrementalFilteringMode="StartsWith">
</PropertiesComboBox>
</dx:GridViewDataComboBoxColumn>

retrieve column data in ListView

how can i retrieve columns data from ListView in asp.net?
in C# can use
listView1.SelectedItems[N].SubItems[X].Text;
But Subitems[X] Doesn't exist in ASP.Net
You have to use FindControl. For instance, if you have something like this in the aspx:
<ListView id="myListView" ...>
...
<ItemTemplate>
<asp:TextBox runat="server" id="myText" />
</ItemTemplate>
</ListView>
to get the text in myText, you can do this:
var text = ((TextBox) myListView.Items[0].FindControl("myText")).Text;

Resources