Hi
I have this datagrid, and need to set cursor and expand list of items in ComboBox, after user clicked add new row (Dodaj).
I don't want to have to click on a cell and then have the list expand. I want it to work automatically.
Is this possible?
<ejs-grid
enablePersistence="true"
showColumnChooser="true"
allowResizing="true"
allowReordering="true"
allowExcelExport="true"
toolbarClick="toolbarClick"
id="Gridf30edcd04749"
allowFiltering="false"
allowSorting="false"
locale="pl-PL"
load="onLoad"
toolbarClick="toolbarClick"
toolbar=toolbarItems
cellEdit="onCellEdit"
actionComplete="complete">
<e-data-manager url="@Url.Page("./Add", new {handler = "DataSource"})"
batchUrl="@Url.Page("./Add", new {handler = "BatchUpdate"})"
adaptor="UrlAdaptor">
</e-data-manager>
<e-grid-filtersettings type="Menu" operators="@(new {stringOperator = Operators.DefaultContains})"></e-grid-filtersettings>
<e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch" showConfirmDialog="false"></e-grid-editsettings>
<e-grid-columns>
<e-grid-column field="LeadId" headerText="ID" isPrimaryKey="true" isIdentity="true" type="number" textAlign="Center" width="100"></e-grid-column>
<e-grid-column field="MaterialTradeNameId" edit="new {@params = new ComboBoxFiltered()}" type="number" headerText="Materiał" dataSource="@Model.MaterialViewModels" foreignKeyField="MaterialTradeNameId" foreignKeyValue="Name"></e-grid-column>
<e-grid-column field="Quantity" type="number" defaultValue="1" headerText="Ilość"></e-grid-column>
<e-grid-column field="Length" type="string" headerText="Długość"></e-grid-column>
<e-grid-column field="Note" type="string" headerText="Notatka"></e-grid-column>
</e-grid-columns>
</ejs-grid>
Below is picture, what i want to have as final result.
|
<ejs-grid id="Grid" allowPaging="true" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
. . . . . . . .
<e-grid-columns>
<e-grid-column field="EmployeeID" headerText="Employee ID" foreignKeyField="EmployeeID" foreignKeyValue="ShipName" . . . . . . width="120"></e-grid-column>
. . . . . . . . . . .
</e-grid-columns>
</ejs-grid>
<script>
document.getElementById('Grid').addEventListener('mouseover', function (args) {
if (args.target.classList.contains('e-ddl')) {
if (args.target.getElementsByTagName('input')[0].getAttribute('name') === 'EmployeeID') {
args.target.getElementsByTagName('input')[0].ej2_instances[0].showPopup();
}
}
});
</script> |
Hi
The solution given is interesting, but unfortunately it does not exhaust the scenario I need. I would like that after clicking "add" from the toolbar, when a new row is added to the table, the system automatically, without clicking on this record, or hovering over it, opens the cell for editing and expand the list of prompts in the ComboBox.
In my code I use custom ComboBox, below the code:
<e-grid-column field="MaterialTradeNameId"
edit="new {@params = new ComboBoxFiltered()}"
type="number"
headerText="Materiał"
dataSource="@Model.MaterialViewModels"
foreignKeyField="MaterialTradeNameId"
foreignKeyValue="Name">
e-grid-column>
using Syncfusion.EJ2.DropDowns;
namespace Components.Syncfusion
{
public class ComboBoxFiltered: ComboBox
{
public ComboBoxFiltered()
{
AllowFiltering = true;
FilterType = FilterType.Contains;
BeforeOpen = "beforeOpenComboBoxFiltered";
ShowClearButton = true;
}
public static ComboBoxFiltered GetComboBoxFiltered=> new ComboBoxFiltered();
}
}
Are you able to help me?
|
let comboBoxObj: ComboBox = new ComboBox({
popupHeight: '230px',
index: 2,
placeholder: 'Select a game',
created: () => {
comboBoxObj.showPopup();
},
}); |
Nice, but how to use this in .Net Core?