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.
Unfortunately, activation email could not send to your email. Please try again.

Dropdownlist returns string even if value was type string.

Thread ID:





128865 Feb 13,2017 07:25 AM Feb 13,2017 07:34 AM Angular 1
Tags: ejGrid
Rykunov Alex
Asked On February 13, 2017 07:25 AM

I have a following grid:

<ej-grid id="Grid" [dataSource]="syncJobs" [allowSorting]="true" (cellEdit)="save($event)" (cellSave)="saveRecord($event)" [allowScrolling]="true"
            [editSettings]="{'allowEditing':'false', 'editMode':'batch', 'showConfirmDialog':false}">
                <e-column field="activityTypeID" foreignKeyField="value" foreignKeyValue="text" [editParams]="{'showPopupOnLoad': true, 'popupHeight':'252px'}" [dataSource]="activityTypesList" headerTextAlign="center" headerText="Деятельность"></e-column>

The activityTypeID field holds an int value. I want to edit this field with dropdown, and for that i've created a datasource "activityTypesList" of text-id pairs. The id, obviously, match the activityTypeID, and the text holds the label for the id. I want that label to be shown in the field, so I've used foreign key property for the field.

The problem I've met is, that even though both grid and dropdown hold int values within itself, when you pick something from the list, the field value becomes string. I have to events to check that — cellEdit, that triggers as soon as editing starts, and that shows me the original field value, and the cellSave, that happens right after the editing had finished, and shows me the edited value. cellEdit rowData shows activityTypeID value being int. cellSave — string. I would prefer, so that the original type would prevail.

I would also prefer not to complicate the grid with editTemplate, if this is possible. 

Please advise.

Rykunov Alex
Replied On February 13, 2017 07:34 AM

Moreso, as I can see, even though the rowData value is just a string, the 'value' that comes with the cellSave event is worse, as it changes itself to the whole dropdownlist object. As an example, the original field value would be 4, the rowData value after editing would be "4", and the event value would be Object: {text: "ExampleActivityType, value: "4"}. It makes it hard to compare "value" and "previousValue", making them essentialy useless. Is this a bug or an intended behaviour?

I would appreciate help on the question.


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.

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.