Have multiple input fields and select field inside the Table. All these field are dynamically created in runtime. Need to navigate and focus the Input or select field using UP, DOWN, LEFT and RIGHT arrow keys. I Am new to Angular help to achieve this functionality.
LEFT ARROW KEY
Focus should moved to previous field from current filed
RIGHT ARROW KEY
Focus should move to next field from current filed
UP ARROW KEY
Focus should move to upper row field (previous row) from current filed
DOWN ARROW KEY
Focus should move to next row field (next row) from current filed
<tr
*ngIf="item?.column?.parameters?.length==0 && !item?.column?.pre_defined && !rowparams?.picklist">
<td *ngFor="let item of [].constructor(item?.column?.count); let i=index;">
<input
type="{{(rowparams?.data_type == 'DTYPE_DATE') ? 'date' : (rowparams?.data_type == 'DTYPE_NUMBER') ? 'number': (rowparams?.data_type == 'DTYPE_TIME') ? 'time': 'text'}}"
id="{{rowparams?.rpp_id+'_'+'cpp'+i}}"
(keyup)="updateEdited(rowparams?.rpp_id+'_'+'cpp'+i)"
style="width:150px;"
(change)="updateEdited(rowparams?.rpp_id+'_'+'cpp'+i)"
value="{{(rowparams?.values && rowparams?.values?.length > 0)? rowparams?.values[i]?.value : ''}}"
(blur)="validateYes($event,rowparams?.data_type)"
(keypress)="validateAlpha($event,rowparams?.data_type)" />
</td>
</tr>
<tr class="test{{rowparams?.picklist}}"
*ngIf="((!item?.column?.pre_defined) || (item?.column?.pre_defined && item?.column?.parameters.length!=0)) && (rowparams?.picklist === true)">
<td
*ngFor="let params of item?.column?.parameters; let i=index;">
<select
*ngIf="rowparams?.picklist_values?.length!=0"
style="width:150px;"
id="{{rowparams?.rpp_id+'_'+params?.cpp_id}}"
(change)="updateEdited(rowparams?.rpp_id+'_'+params?.cpp_id)">
<option
*ngFor="let option of rowparams?.picklist_values"
value="{{option.name}}"
[selected]="option.id==((rowparams?.values && rowparams?.values?.length > 0)? rowparams?.values[i]?.picklist_id : '')">
{{option.name}}</option>
</select>
</td>
</tr>