Change Event in LightSwitch HtmlClient?
While Developing an application in Lightswitch HtmlClient I faced a problem that how can we get the price of selected Product when a sales person sales an item. We can do this thing on change event of the product selection. But in Lightswitch HtmlClient Application we can call the change event with the help of addChangeListener function. Following are the steps to resolve this problem.
Problem:
How to fetch the Price of selected Product in text field.
Resolution:
Step 1: write the following code on the Created event of the current screen.
myapp.AddEdittbOrderLineItem.created
= function
(screen) {
// Write
code here.
screen.tbOrderLineItem.addChangeListener("tbProduct", function (e) {
var contentItem = screen.findContentItem("tbProduct");
screen.tbOrderLineItem.ProductPrice =
contentItem.details.value.Price;
});
};
Result: Now you are able to get the selected Product price.
3 comments:
Can i get the complete step,
i am not getting teh selected value from Model picker.
Sunil Singh: Are you using the another table from which you want to fetch the selected value as shown in the tbProduct in this post?
Hi, I tried your code but no chance to get it to work.
indeed I'm using data from another table in the picker.
thanks
Stephane
Post a Comment