Add event to tab selection in Lightswitch HTML client -
Using Lightweight 2013 HTML Clients is trying to add an event that will fire when the tab on screen is selected (Or will be clicked) I do not get any results with the following code: -
myapp.ViewThing.HistoryTab_postRender = function (element, contentItem) {$ (element). Click (function () {warnings ("clicked on tab !!!");}); $ (Element). Selection (function () {warning ("select tab !!!");}); };
There is a post render code for a tab on the top screen. This type of code works for other screen objects, such as text fields.
Any thoughts that I am doing wrong, or why it should not work for tabs?
Thank you!
You can use jQuery to hook a related listener on tab container (any One time event per screen in the posterender) and only currently active tab
myapp.ViewThing.HistoryTab_postRender = function (element, contentItem) {$ (".mls-tabs-container li") take care. On ("click", function (e) {$ .each (contentItem.screen.details.pages, function) {if (this .___ is active) {// Usage 'this'};});}); };
Another possibility is to find the DOM tree for the nearest related div by using
myapp.ViewThing.HistoryTab_postRender = function (element, contentItem) {$ (Element) .closest ("div [data-role = 'page']"). (".msl-tabs-container li"). Click (function (e) {// use $ (this)}); };
Comments
Post a Comment