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.

same values binding when added new records in ejgrid with dropdown controls

Thread ID:

Created:

Updated:

Platform:

Replies:

124584 Jun 15,2016 12:27 PM Jun 20,2016 06:03 AM ASP.NET MVC 5
loading
Tags: Grid
siva dandamudi
Asked On June 15, 2016 12:27 PM

when i added a new record in ejgrid after selecting the different values in drodown template column after save click from edittoolbars same value is binding to dropdown columns.
 var wotypelist = @Html.Raw(Json.Encode(Model.lstEquipment.SelectMany(a => a.WorkorderTypes).Where(t => t.Text != null).ToList()));
    var WorkordertypeDS = [];  
    var lengt = wotypelist.length;
    for                (i = 0; i < lengt; i++)
    {
        var WoType = {
            "text" : wotypelist[i].Text,
            "value" : wotypelist[1].Value
        };
        WorkordertypeDS.push(WoType);
    };
    var categorylist = @Html.Raw(Json.Encode(Model.lstEquipment.SelectMany(a => a.categories).Where(c => c.Text != null).ToList()));
    var categoryDS = []; 
    var lengt = categorylist.length;
    for(i = 0; i < lengt; i++)
        {
        var caType = {
            "text" : categorylist[i].Text,
            "value" : categorylist[1].Value
                    };
        categoryDS.push(caType);
    };
        $(function () {
            $("#Equipmentgrid").ejGrid({                
                dataSource: @Html.Raw(Json.Encode(Model.lstEquipment)),
                allowPaging: true,
                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
                toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
                columns: [
                        { field: "SelectedWorkOrderType", headerText: "Work Order Type", editType: ej.Grid.EditingType.Dropdown,dataSource:WorkordertypeDS, foreignKeyField: "value", foreignKeyValue: "text", textAlign: ej.TextAlign.center, validationRules: { required: true, number: true }, width: 90 },
                        { field: "SelectedCategory", headerText: "Category", editType: ej.Grid.EditingType.Dropdown,dataSource:categoryDS,foreignKeyField: "value", foreignKeyValue: "text", textAlign: ej.TextAlign.center, width: 90 },
                        { field: "EquipmentLocation", headerText: 'Equipment Location', width: 150 },
                        { field: "SerialNumber", headerText: 'Serial Number', width: 100 },
                        { field: "CatalogID", headerText: 'Catalog ID', width: 90 },
                        { field: "Model", headerText: 'Model', width: 90 }
                       ]
            });           

        });
        //$("#sampleProperties").ejPropertiesPanel();
        function onSelectionTypeChange(args) {
            $("#Equipmentgrid").ejGrid("cancelEdit");
            $("#Equipmentgrid").ejGrid("model.editSettings.rowPosition", args.selectedValue);
        }

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On June 16, 2016 08:08 AM

Hi Siva, 
      
 
We have analyzed your code Snippet and created a sample based on your requirements but we are unable to reproduce the issue “dropdown column value gets saved with wrong value”. Please refer the sample attached.  
 
 
 
 
Could you please share us the following details so that we could sort out the cause of the issue and provide a solution as early as possible? 
 
1.       Explain you scenario clearly 
2.       Please share proper replication procedure.  
3.     Attach Screenshot of the issue. 
4.       If possible replicate the issue in the above sample and send us back 

 
The provided information will help to analyze the issue and provide you the response as early as possible.  
 
 
Regards, 
Farveen.T 


siva dandamudi
Replied On June 16, 2016 09:54 AM

i made the datasiurce for Ejgrid dropdown template like below
 var wotypelist = @Html.Raw(Json.Encode(Model.lstEquipment.SelectMany(a => a.WorkorderTypes).Where(t => t.Text != null).ToList()));
    var WorkordertypeDS = [];  
    var lengt = wotypelist.length;
    for                (i = 0; i < lengt; i++)
    {
        var WoType = {
            "text" : wotypelist[i].Text,
            "value" : wotypelist[1].Value
        };
        WorkordertypeDS.push(WoType);
    };

and ejgrid binding code  like as mentioned in my 1st post.

i tried to add new records in UI like bwlow i mage, what i observed after save btton click dropdowns took last item of dropdowns , product Branding and Frozen Cappuccino are last items in both dropdwonsUI dropdowns

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On June 17, 2016 03:39 AM

Hi Siva, 

We are able to reproduce the problem at our end with the given code example. While generating the “text” and “value” pair for the WorkordertypeDS array, you have wrongly mentioned “1” for the value variable instead of mentioning “i” as variable, which is the cause of the problem. Refer to the following code example and sample. 
 
        var WorkordertypeDS = []; 
        var lengt = wotypelist.length; 
        for (i = 0; i < lengt; i++) { 
            var WoType = { 
                "text": wotypelist[i].Text, 
                "value": wotypelist[1].Value// it must be Ds[i].Value 
            }; 
            WorkordertypeDS.push(WoType); 
        } 
 
 
After updating the text and value pair with the correct variable “i”, we are able to update the value in the Grid. Refer to the following sample. 
 
 
Regards, 
Seeni Sakthi Kumar S. 


siva dandamudi
Replied On June 17, 2016 01:41 PM

Thanks for found the mistake , Now it's every thing fine, and  i have one more question regarding Styles. in drop down i observed some space with down arrow symbol. i used below css and js files for ej controls. please find the reason.
<link rel='nofollow' href="@Url.Content("~/Content/ejthems/web/default-theme/ej.web.all.min.css")" rel="stylesheet" />
    <link rel='nofollow' href="~/Content/ejthems/web/ej.widgets.core.min.css" rel="stylesheet" />
    <link rel='nofollow' href="~/Content/ejthems/web/default-theme/ej.theme.min.css" rel="stylesheet" /> 
    <link rel='nofollow' href="~/Content/themes/base/jquery.ui.all.css" rel="stylesheet" />
    <link rel='nofollow' href="~/Content/jquery.jqGrid/ui.jqgrid.css" rel="stylesheet" />
    <link rel='nofollow' href="~/Content/ejthems/web/responsive-css/ej.responsive.css" rel="stylesheet" />      
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/jquery")
    <script src="~/Scripts/jquery-ui.js"></script>
    @Scripts.Render("~/bundles/jqgrid")

    <script src="~/Scripts/ui.core.js"></script>
    <script src="~/Scripts/ui.dropdownchecklist.js"></script>
    @Scripts.Render("~/bundles/bootstrap")    
    <script src="@Url.Content("~/Scripts/jquery.easing.1.3.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jsrender.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.web.all.min.js")"></script>dropdown
   
i

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On June 20, 2016 06:03 AM

Hi Siva, 

We are unable to reproduce the issue at our end. We have prepared a sample with the provided code example reference scripts and css that can be downloaded from the following location. 


We could see that you are using Custom CSS for your project. Please share the following information to analyze the issue and provide you solution as early as possible. 

1)      We could see some bundle config reference. Send the bundle config file to us 
2)      If possible, replicate the issue in attached sample and send back to us. 
3)      If you are using any custom CSS. Also share those code too. 

Regards, 
Seeni Sakthi Kumar S. 


CONFIRMATION

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.

;