I am using this Example https://stackblitz.com/edit/angular-efjsmp-ulvs8d?file=app.component.html for adding a new row in the Grid. I am looking at adding a functionality where user clicks on add button. which will bring up blank row ( Demo does exactly that) then for example if user types few characters in customer ID column, then it will show suggested values from master array. Something like how Google search suggest terms.
|
[app.component.html]
<ejs-autocomplete
id="CustomerID"
width="200"
[dataSource]="data"
[fields]="fields"
></ejs-autocomplete> |
|
[app.component.ts]
addRecord() {
this.record = {
OrderID: Number(document.getElementById('OrderID').value),
EmployeeID: Number(document.getElementById('EmployeeID').value),
CustomerID: document.getElementById('CustomerID').ej2_instances[0].value,
Title: document.getElementById('checkvalue').checked,
};
this.grid.addRecord(this.record);
} |
I am looking at the autocomplete functionality within grid cell it self. when you click on Add new Row and it will add blank row. and autocomplete functionality is available for desired cell within row.
your example is looking at the autocomplete outside grid.
|
<div class="control-section">
<ejs-grid [dataSource]="data" allowPaging="true" [pageSettings]="pageSettings" [editSettings]="editSettings" [toolbar]="toolbar" (actionBegin)="actionBegin($event)" (actionComplete)="actionComplete($event)" > <e-columns> <e-column field="OrderID" headerText="Order ID" width="120" textAlign="Right" [isPrimaryKey]="true" ></e-column> <e-column field="CustomerName" headerText="Customer Name" width="120" ></e-column> <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right" ></e-column> <e-column field="OrderDate" headerText="Order Date" width="130" format="yMd" textAlign="Right" ></e-column> <e-column field="ShipCountry" headerText="Ship Country" width="150" ></e-column> </e-columns> <ng-template #editSettingsTemplate let-data> <div ngForm #orderForm="ngForm"> <table class="e-table e-inline-edit" cellspacing="0.25"> <colgroup> <col style="width: 120px;" /> <col style="width: 120px;" /> <col style="width: 120px;" /> <col style="width: 130px;" /> <col style="width: 150px;" /> </colgroup> <tbody> <tr> <td style="text-align: right" class="e-rowcell"> <div class="e-input-group" [ngClass]="{ 'e-disabled': !data.isAdd }" > <input class="e-input e-field" [(ngModel)]="orderData.OrderID" required [attr.disabled]="!data.isAdd ? '' : null" name="OrderID" type="text" (focus)="focusIn($event.target)" (blur)="focusOut($event.target)" #OrderID style="text-align: right" /> </div> </td> <td class="e-rowcell"> <div class="e-input-group"> <input class="e-input e-field" name="CustomerName" [(ngModel)]="orderData.CustomerName" required type="text" (focus)="focusIn($event.target)" (blur)="focusOut($event.target)" #CustomerName /> </div> </td> <td style="text-align: right" class="e-rowcell"> <ejs-numerictextbox name="Freight" id="Freight" [(ngModel)]="orderData.Freight" floatLabelType="Never" ></ejs-numerictextbox> </td> <td style="text-align: right" class="e-rowcell"> <ejs-datepicker id="OrderDate" name="OrderDate" required [(ngModel)]="orderData.OrderDate" floatLabelType="Never" ></ejs-datepicker> </td> <td class="e-rowcell"> <ejs-autocomplete id="ShipCountry" name="ShipCountry" [(ngModel)]="orderData.ShipCountry" [dataSource]="shipCountryDistinctData" [fields]="{ text: 'ShipCountry', value: 'ShipCountry' }" popupHeight="300px" floatLabelType="Never" ></ejs-autocomplete> </td> </tr> </tbody> </table> </div> </ng-template> </ejs-grid> </div> |
Thanks for the response. Few Questions
Code which is not working against ResouceName column. out of the box it applies TOLOWER which is not allowed in Sharepoint REST API. because of which my code is failing to fetch the infromation.
If i can construct my own URL for search or there is another way to search. If I construct my own URL then I will be needing the idea as to how can i pass my search term as user types in data. Also, I am required to populate other columns in grid once user searches name in auto complete and then populate data in other columns like ResourceType, Internal/External etc.
My requirement is very simple. I want to have search functionality in my grid cell. I dont understand whether i am not able to explain or i am not able to understand what you guys are explaining it to me.
I have 2 Tables and 2 APIs. one is master and second is child. When I expand Parent/Master row. I want to bind the Child grid. Which i am able to do it. Now, within this child grid I have add Row functionality. which is working just fine. Once user adds a new row. one of the column needs to have search functinality which will auto complete user's search and suggests some user names. JQUERY can do this really easily....
Please refer to below code in Javascript. Which is working just fine where i am not using syncfusion controls