onShow Events

Posted by mflanegan on 27-Jan-2016 01:23

Hi there,

I have a list view in my Telerik Mobile App and in the auto generated code it creates an onShow event which does an appserver hit every time the page shows. 

I do not want this, I want to be able to do an appserver call on enter of my search control. 

Is there a way to override this onShow event so that it doesn’t fire or do I have to create a blank view with custom HTML and Javascript? 

If overriding this event is possible so that it doesn’t fire, how would I do it?

Thanks in advance,

Meyrick

All Replies

Posted by egarcia on 27-Jan-2016 07:02

Hello Meyrick,

Some aspects of this question are Telerik Platform specific and could be posted to the corresponding Telerik forum.

You should be able to override the onShow event by using the same technique mentioned in thread:

   community.progress.com/.../22575

You can override properties in the app object, including app.home.homeModel.

Example:

// START_CUSTOM_CODE_homeModel

app.home.set('onShow', fn);    

// END_CUSTOM_CODE_homeModel

A possible way to do this is to have code similar to the one that is generated and add your code to prevent the JSDO and the Kendo UI DataSource from being created a second time.

I believe that the read actually happens when the dataSource property is set on the ListView.

You can set autoBind so that a read would happen only when performed from the data source. The ListView would be then populated when the change event of the data source fires.

Example:

               app.home.homeModel.set('autoBind', false);  

Link: docs.telerik.com/.../listview

You would need to refer to app.data.progressDataProvider and app.home.homeModel instead of the variables that used in the original code.

Something to test is to make sure that the app behaves correctly when the app comes back into the foreground after being suspended on the mobile device. Perhaps, you would need to capture the Resume event for this.

I hope this helps.

Posted by mflanegan on 29-Jan-2016 05:00

Hi Edsel,

Thanks, this did the trick!

This thread is closed