ngModel - delete last character - angular-material2

i am using mat-radio-group to bind my data. here data & value are same. which means i have 4 value binded and all 4 value are same. So to differentiate the radio buttons i added index as last value for every radio button.
Now i want to fetch this radio button value into my typescript and also eliminate the lastcharacter(which is index). so i use ngModel & ngModelChange.
I can get the output. but the `mat-radio-button' is not selecting
Here is my code
`
<mat-radio-group class="radioButtonAxis" [(ngModel)]="ngM_Fax" (ngModelChange)="onFaxChange($event)">
<mat-radio-button *ngFor='let data of resultSet;index as i' [value]='data.Fax+i'>{{data.Fax}}</mat-radio-button>
</mat-radio-group>
onFaxChange(value){
this.ngM_Fax = value.substring(0, value.length - 1);
}
`
expecting your help on this.

You are using ngModel wrong. The right value is always in this.ngM_Fax, but it has to match 100% [value]. If you want to use the variable without the index, i would suggest to use an extra variable.
Here is a working StackBlitz.

Related

Why isn't my report changing the sorting based on the input radio button being toggled?

I have a report that I want sorted differently based on 2 radio buttons (boolean input parameter). If the true radio button is selected, sort by Sum(Fields!plannedPallets.Value), otherwise sort by Sum(Fields!lbrHrsPlanned.Value). However, I'm having trouble with the syntax to use in the expression for sorting the group.
This is what I've tried:
="Sum(Fields!" & IIF(Parameters!PalletSorting.Value = True, "plannedPallets", "lbrHrsPlanned") & ".Value)"
...but this has no effect on the sorting. My guess is because I'm returning a string here when it's expecting something else.
Figured it out. It was simply:
=IIF(Parameters!PalletSorting.Value = True, Sum(Fields!plannedPallets.Value), Sum(Fields!lbrHrsPlanned.Value))

How to set in Report the TextBox visibility by expression in VisualStudio?

I have a simple TextBox in my Precision Design related to a Field in Temporary Table.
I need to show this TextBox only If the it value under Temporary Table is pupulated : so if the value field is pupulated (is a string) I show the Text Box , otherwise I don't show the text Box.
I need to set Visibility by Expression :
Which is the best way forward over ?
Thanks!
You can use iif function. Press fx button, here you can writte your code.
iif function evaluate a condition and return 1 of 2 options, for example, in your case you need show one value only if exist.
check this code:
=iif(fields!YourFieldName.value = "", true, false)
if your field is a number
=iif(fields!YourFieldName.value = 0, true, false)
This code evaluate the value of your field and only populate the value if is complete.

Getting values from Kendo Grid row on DetailExpand

I have got a Kendo Grid and I want to access the data from the row whose detail I expanded. For testing purposes, I have this:
function detailExpand(e)
{
var aux = e.sender.MyModelId;
var aux2 = this.MyModelId;
...
But none of those variables have the MyModelId in it.
I have inspected it and I can't find the model properties unless inside the e.sender._data[index-here] but I don't know the index of the row whose detail I've expanded.
e.sender.dataItem(e.masterRow).MyModelId
http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-detailExpand
http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-dataItem
For the record, you should try to avoid using methods starting with an underscore (_). I believe kendo uses the underscore to show it's an internal method (a "private"). Unexpected behavior could occur.

How do I reset a KendoDropDownList selected index back to -1 (nothing selected)

When a KendoDropDownList is created it's initial index is set to -1 and the text is empty.
IE: $("#txtQPLPickupFrom").data("kendoDropDownList").select() would return a -1.
When a selection is made, the select() returns the selected index (0,1,2,3...).
My question is, I want to return the selected index back to -1 when I am displaying an new record entry where the user has not selected a value. Trying to use .select(-1) does not seem to work. So it there a way to restore the initial selection to nothing (-1) after it's already had a value.
This should work:
$("#txtQPLPickupFrom").data("kendoDropDownList").value(-1);
Here is a fiddle (not mine): http://jsfiddle.net/EaNm4/124/
The kendo dropdown will always default to the first item in its datasource. You could configure the dropdown to use optionLabel: ' ' (a space), which will cause the initial value selected to have no text.
You could then reset the selection to this value with .select(0).
This seems to work: (I have to do more testing)
var txtQPLPickupFrom = $("#txtQPLPickupFrom").data("kendoDropDownList");
txtQPLPickupFrom.text(txtQPLPickupFrom.options.optionLabel);
txtQPLPickupFrom.element.val("");
txtQPLPickupFrom.selectedIndex = -1;
This worked for me:
$("#Actions").data("kendoDropDownList").refresh();
use txtQPLPickupFrom.value(-1)
txtQPLPickupFrom.value(-1);
this should set it to empty

How to click on an AutoCompleteExtender with Watin

For my acceptance testing I'm writing text into the auto complete extender and I need to click on the populated list.
In order to populate the list I have to use AppendText instead of TypeText, otherwise the textbox looses focus before the list is populated.
Now my problem is when I try to click on the populated list. I've tried searching the UL element and clicking on it; but it's not firing the click event on the list.
Then I tried to search the list by tagname and value:
Element element = Browser.Element(Find.By("tagname", "li") && Find.ByValue("lookupString"));
but it's not finding it, has anyone been able to do what I'm trying to do?
The shorter version of that is:
string lookupString = "string in list";
Element list = Browser.Element("li", Find.ByText(new Regex(lookupString)));
list.MouseDown();
Regexs will do a partial match so you don't need to specify .* either side and use string.Format. This assumes however that the lookupString doesn't contain any characters special to Regexs, they'd need to be escaped.
In case someone has the same problem. It works with the next code:
string lookupString = "string in list";
Regex lookup = new Regex(string.Format(".*{0}.*", lookupString));
Element list = Browser.Element("li", Find.ByText(lookup));
list.MouseDown();

Resources