We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

editTemplate selectedItemIndex

Thread ID:





128684 Feb 6,2017 06:45 AM UTC Feb 7,2017 11:57 AM UTC Angular 2
Tags: ejGrid
Rykunov Alex
Asked On February 6, 2017 06:45 AM UTC

I have the following grid:

[editTemplate]="{create:dropCreate, read:dropRead, write:replacedDropWrite}">

[editTemplate]="{create:dropCreate, read:dropRead, write:userDropWrite}">>

[editTemplate]="{create:dropCreate, read:dropRead, write:projectDropWrite}">>

I need the editTemplate because I need to slightly customise my dropdown — to add filterSearch in it. Here's one of the editTemplate 'write' methods:
args.element.ejDropDownList({enableFilterSearch:"true", width: "100%", dataSource: args.column[1].dataSource, fields: { text: "value", value: "value" }, selectedItemIndex:args.rowData != undefined ? args.rowData["userId"] : 0 });
The whole problem I have is with selectedItemIndex property. Logically, I want dropdown to have the exact value to be selected, that was selected before. So, if I have a value of 2 in the unedited record, i want "2" to be the dropdown's selected value too. However, that seems not to be possible.
The "rowData" property of the args I could've used to select a proper value, comes undefined always. There's no other properties in the args that could've been used to get the required data. I am not willing to use Jquery in this project to solve the problem that way. So, answer any question of the following:
Why the rowData comes undefined? Is there a way to fix it?
Is there a way to select the value needed without setting the selectedItemIndex?
Or, if editTemplate does not work as intended, is there a way to customise a dropdown that is created by default, without editTemplate?
I will await your answer.

Rykunov Alex
Replied On February 6, 2017 09:13 AM UTC

A solution is simple. It seems the online documentation does not describe "editParams" property in the right way. EditParams works for every in-cell editor, and not just numeric textbox. As an example, my solution works perfectly:

 <e-column field="replacedUserId" [editType]="Dropdown" [editParams]="{'showPopupOnLoad':true, 'enableFilterSearch':'true'}" foreignKeyField="value" foreignKeyValue="text" [dataSource]="users" headerText="User" >

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On February 7, 2017 11:57 AM UTC

Hi Alex,  
Thanks for the update. We have also explained about the functionality of the EditParams in the following Help Document. 
This document explains the params that were applicable for some of the ej controls. In the following API doc, we have shown the reference for editParams with a single control but it can also be used for multiple controls as explained in the above Help Document. 
We are also happy to hear that you have figured out the solution and you are good to go. Please get back to us, if you require further assistance on this. 
Seeni Sakthi Kumar S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon