We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Client side OnItemSelect handler on the Listbox control

I'm trying to use the Listbox OnItemSelect handler but I can't figure out how to access the event handler arguments.

The help file states the following.

selectedItem : The item which is selected in the listbox.

selectedItemIndex : The index of the item which gets selected.

hasChild: The list items whether contains child or not.

Text: The text value of the item selected.

itemCollection : Items in the Listbox control.

selectedItemNames : Selected items among the list of items.


I've supplied a handler like so

Html.MobSyncfusion().ListBox("lbCore").OnItemSelect("itemSelectedHandler").RenderMode(RenderMode.Auto)

                .IOS(ios => ios.ShowCorners(true))

                 .Items(items =>

                 {

                     items.Add().Text("Item 1");

                     items.Add().Text("Item 2");

                     items.Add().Text("Item 3");

                     items.Add().Text("Item 4");

                 })

           .Render();

The help file does not specify how to access the arguments.

I've tried to specify the arguments in the handler's signature but this doesn't seem to work.  Here is an example.

function itemSelectedHandler(selectedItem, selectedItemIndex, hasChild, Text, itemCollection, selectedItemNames)

{

    $("#divToChange").html("<a rel='nofollow' href='#'>" + Text + "</a>");

}

The output is undefined.

How can I gain access to the handler's arguments?


Thanks!


11 Replies

TH Thivya Syncfusion Team November 15, 2012 10:47 AM UTC

Hi James,

Thanks for using Orubase Product.

Please find the following handler function to access the OnItemSelect handler argument.

function itemSelectedHandler(event, model)
{
    $("#divToChange").html("<a rel='nofollow' href='#'>" + model.Text + "</a>");
}


Like this way you can also access the other properties as accessed above.
for eg., model.selectedItem

Please let us know if you need any further assistance.

Regards,
Thivya.



KR krishnaveni January 11, 2013 05:34 AM UTC

Hi,

I am implementing a list box which displays list of items retrieved from the database, like this

@Html.Orubase().ListBox("Mails").RenderMode(RenderMode.Auto).Items(items =>
                            {
                                items.Add().Html(
                                "<div><div>From: " + @Model.ElementAt(i).frommail + "</div><div>Date: " + @Model.ElementAt(i).sent_date + "</div><div>Subject: " + @Model.ElementAt(i).subject + "</div></div>"
                                );
                            }).OnItemSelect("loadPartialTab1");

Now, when I select an item this will invoke the loadPartialTab1 handler but I want to pass some arguments like mail id through this handler, is that possible.

Thanks in advance


TH Thivya Syncfusion Team January 11, 2013 11:46 AM UTC

Hi Krishnaveni,

Thanks for you interest in Orubase.

We regret that you cannot pass arguments directly to the handler but you can achive your requirement by getting your desired value from the selected item obtained from the argument in the handler. We have attached one simple reference sample hereby. Please go through the sample and get back to us if you have any queries.

Regards,
Thivya.


OrubaseProject_81cc486d.zip


KR krishnaveni January 18, 2013 07:45 AM UTC

Hi,
 
   Thank you for the sample, this sample is woking fine in android emulator but when I am running the same sample in windows phone emulator then the first tab is working fine but when I am clicking the second tab that was displaying undefined.
 
Thank you in advance.


TH Thivya Syncfusion Team January 22, 2013 05:51 AM UTC

Hi Krishnaveni,

We are not able to reproduce the issue with windows phone emulator as you mentioned. Could you please send us the emulator version details or else send us the sample in which you faced this issue. The information you provide will be great helpful to help you further.

Regards,
Thivya.


KR krishnaveni January 22, 2013 09:10 AM UTC

Hi,

    I am using
  • Syncfusion Orubase Studio 1.1.0.56
  • Windows Phone SDK 7.1 Extensions for XNA Game Studio 4.0
  • Windows Phone SDK 7.1 Assemblies  version - 10.0.40219
  • Windows Phone SDK 7.1 Add-in for Visual Studio 2010 - ENU version - 10.0.40219
  • Windows Phone SDK 7.1 - ENU version - 10.1.40219
  • Windows Phone Emulator - ENU version - 10.0.40219
  

Thank you in advance


KR krishnaveni January 22, 2013 09:17 AM UTC

Hi,

    I am using
  • Syncfusion Orubase Studio 1.1.0.56
  • Windows Phone SDK 7.1 Extensions for XNA Game Studio 4.0
  • Windows Phone SDK 7.1 Assemblies  version - 10.0.40219
  • Windows Phone SDK 7.1 Add-in for Visual Studio 2010 - ENU version - 10.0.40219
  • Windows Phone SDK 7.1 - ENU version - 10.1.40219
  • Windows Phone Emulator - ENU version - 10.0.40219
  I have send attachment for sample application to support@syncfusion.com, this sample is running well in android emulator,
but in windows emulator when we click on the second tab it is displaying undefined.

Thank you in advance


KR krishnaveni January 24, 2013 12:09 PM UTC

Hi all,

      I have created a orubase application with a login page, tabs, list boxes and I am using data from the database. Now I want to add a special feature only for android but not for WP7, WebApplication and IOS, using the same database, So to achieve that I am trying implement the code in eclipse for the same application, is this possible? How can I do this?

Thanks in advance


TH Thivya Syncfusion Team January 28, 2013 11:33 AM UTC

Hi Krishnaveni,

Query 1 : In windows emulator when we click on the second tab it is displaying undefined.

This is an known issue with Tab control in Windows phone we have fixed this issue in our Development build. So, We would suggest you to update to the latest version available in the following link.

http://www.orubase.com/support/forums/orubase/106508/Orubase-Studio-v11063-available-for-download

Query 2 : Special feature only for Android

Could you please ensure us whether you want to give special feature for Android by using the database which is in the Web application or else with SQLite database. If you want to use the database as in the Web application then you can do the following to give us desired functionality for Android only.

if (Helper.IsAndroid())
{
  
//your Desired Code
}

else

{
  
//your Desired Code
}

//Helper Code

public static bool IsAndroid(){
  
var exp = new Regex("android");
  
return HttpContext.Current.Request.UserAgent != null && exp.IsMatch(HttpContext.Current.Request.UserAgent.ToLower());

}

Please try this and get back to us if this helps out.

Regards,
Thivya.



KR krishnaveni January 28, 2013 12:02 PM UTC

Hi,

Thank you for the response and your patience, for understanding my queries.

Special feature only for Android:

I have implemented orubase application, now I want to add new feature like recording audio only for android mobiles not for web, wp7 and IOS. For that I have given a button in one of the view page in web application and I have implemented recording audio application using eclipse. Now I want to integrate this audio application to my web application when I click the button in the view page. Is their any way for achieving this.

Thank you in advance.




SS Sahaya Sweetlin Ponmalar P Syncfusion Team January 31, 2013 09:46 AM UTC

Hi Krishnaveni,

 

We have created the Capture Audio sample for Android. With the Capture Audio API there is an issue, when clicking the Record button twice the application will crash. We are analyzing this issue. Please refer the below forum for further updates on this issue.

 

http://www.syncfusion.com/support/forums/general/106118/Tutorial

 

Please let  us know if you have any queries

 

Regards,

Ponmalar P



CaptureAudio_11167133.zip

Loader.
Live Chat Icon For mobile
Up arrow icon