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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

cannot read property groupid of undefined

Thread ID:

Created:

Updated:

Platform:

Replies:

144189 Apr 24,2019 06:06 AM UTC Apr 29,2019 08:51 AM UTC ASP.NET MVC - EJ 2 6
loading
Tags: Schedule
tirathpal
Asked On April 24, 2019 06:06 AM UTC

Uncaught TypeError: Cannot read property 'GroupID' of undefined
    at l (event-window.js:1247)
    at e.resourceSaveEvent (event-window.js:1289)
    at e.eventSave (event-window.js:1049)

my code is : - 

            @(Html.EJS().Schedule("Schedule1")
                .Width("100%")
                .Height("450px")
                .Views(view => {
                    view.Option(View.TimelineDay).Add(); })
                .CurrentView(View.TimelineDay)
                .SelectedDate(DateTime.Now)
                .Group(group => group.Resources(ViewBag.Resources))
                .Resources(res => {
                    res.DataSource(ViewBag.ImplementLst)
                       .Field("ImplementId")
                       .Title("Implement Type")
                       .Name("Implements")
                       .TextField("ImplementName")
                       .IdField("id")
                       .AllowMultiple(false)
                       .Add(); })
                
                .ResourceHeaderTemplate("#resource-template")
                .EventSettings(new ScheduleEventSettings { DataSource = ViewBag.datasource })
                .EditorTemplate("#EventEditorTemplate")
                .ShowQuickInfo(false)
                .PopupOpen("onPopupOpen")
                .Render())

            @Html.EJS().ScriptManager()
<script id="EventEditorTemplate" type="text/template">
    <table class="custom-event-editor" width="100%" cellpadding="5">
        <tbody>
            <tr>
                <td class="e-textlabel">Summary</td>
                <td colspan="4">
                    <input id="Subject" class="e-field e-input" type="text" value="" name="Subject" style="width: 100%" />
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">Status</td>
                <td colspan="4">
                    <input type="text" id="ImplementId" name="ImplementId" class="e-field" style="width: 100%" />
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">From</td>
                <td colspan="4">
                    <input id="StartTime" class="e-field" type="text" name="StartTime" />
                </td>
            </tr>
            <tr>
                <td class="e-textlabel">To</td>
                <td colspan="4">
                    <input id="EndTime" class="e-field" type="text" name="EndTime" />
                </td>
            </tr>
        </tbody>
    </table>
</script>
<script type="text/javascript">    function onPopupOpen(args) {
        if (args.type === 'Editor') {
             var ImpData = @Html.Raw(Json.Encode(ViewBag.ImplementLst));
            var statusElement = args.element.querySelector('#ImplementId');
            if (!statusElement.classList.contains('e-dropdownlist')) {
                var dropDownListObject = new ej.dropdowns.DropDownList({
                    placeholder: 'Choose status', 
                    fields: { text: 'ImplementName', value: 'id'},
                    dataSource: ImpData
                });
                dropDownListObject.appendTo(statusElement);
                statusElement.setAttribute('name', 'ImplementId');
            }
            var startElement = args.element.querySelector('#StartTime');
            if (!startElement.classList.contains('e-datetimepicker')) {
                new ej.calendars.DateTimePicker({ value: new Date(startElement.value) || new Date() }, startElement);
            }
            var endElement = args.element.querySelector('#EndTime');
            if (!endElement.classList.contains('e-datetimepicker')) {
                new ej.calendars.DateTimePicker({ value: new Date(endElement.value) || new Date() }, endElement);
            }
        }
    };
</script>


Vinitha Devi Murugan [Syncfusion]
Replied On April 25, 2019 09:02 AM UTC

Hi Tirathpal,  
 
Greetings from Syncfusion Support.  
 
We have checked the shared code in which value not mapped in resource which could cause the reported problem. Please check the following sample for your reference.  
 
 
function onPopupOpen(args) { 
        if (args.type === 'Editor') { 
             var ImpData = @Html.Raw(Json.Encode(ViewBag.ImplementLst)); 
            var statusElement = args.element.querySelector('#ImplementId'); 
            if (!statusElement.classList.contains('e-dropdownlist')) { 
                var dropDownListObject = new ej.dropdowns.DropDownList({ 
                    placeholder: 'Choose status', value: args.data.ImplementId, 
                    fields: { text: 'text', value: 'Id' }, 
                    dataSource: [ 
                        { Id: 1, text: 'PROJECT 1' }, 
                        { Id: 2, text: 'PROJECT 2' }, 
                    ] 
                }); 
                dropDownListObject.appendTo(statusElement); 
                statusElement.setAttribute('name', 'ImplementId'); 
            } 
            var startElement = args.element.querySelector('#StartTime'); 
            if (!startElement.classList.contains('e-datetimepicker')) { 
                new ej.calendars.DateTimePicker({ value: new Date(startElement.value) || new Date() }, startElement); 
            } 
            var endElement = args.element.querySelector('#EndTime'); 
            if (!endElement.classList.contains('e-datetimepicker')) { 
                new ej.calendars.DateTimePicker({ value: new Date(endElement.value) || new Date() }, endElement); 
            } 
        } 
    }; 
 
 
 
Please try the sample and revert us back if you still face any issue.  
 
Regards, 
M.Vinitha devi. 


tirathpal
Replied On April 26, 2019 02:57 AM UTC

yes, it's working now thanks for help. can please tell how can i get this value to my mvc model

Nevitha Ravi [Syncfusion]
Replied On April 26, 2019 10:13 AM UTC

Hi Tirathpal, 

Thanks for your update. 

We are glad that our solution helped you. Now we have prepared CRUD sample to save the resource field which can be downloaded from the following link. 
 
Please refer the table structure and model class for the scheduler event. 
 
 
 
Regards, 
Nevitha 
 



tirathpal
Replied On April 26, 2019 10:57 AM UTC

hi there thanks for reply,
              i have an issue which is regarding the dropdown filling. if i fill the dropdown with static data it works fine if pulled from request it push an error of groupid undefined
this is static data.
 dataSource: [
                        { Id: 1, text: 'Alice' },
                        { Id: 2, text: 'Nancy' },
                        { Id: 3, text: 'Robert' },
                        { Id: 4, text: 'Robson' },
                        { Id: 5, text: 'Laura' },
                        { Id: 6, text: 'Margaret'}
                    ]
but i want it to be dynamic. please do guide me for this


tirathpal
Replied On April 26, 2019 11:36 AM UTC

hi there thanks for reply,
              i have an issue which is regarding the dropdown filling. if i fill the dropdown with static data it works fine if pulled from request it push an error of groupid undefined
this is static data.
 dataSource: [
                        { Id: 1, text: 'Alice' },
                        { Id: 2, text: 'Nancy' },
                        { Id: 3, text: 'Robert' },
                        { Id: 4, text: 'Robson' },
                        { Id: 5, text: 'Laura' },
                        { Id: 6, text: 'Margaret'}
                    ]
but i want it to be dynamic. please do guide me for this


hi there and thanks to all,

done by using this code.

please check and revert that if have right or wrong.

function onPopupOpen(args) {
        if (args.type === 'Editor') {
            var ImpData = @Html.Raw(Json.Encode(ViewBag.ImplementLst));
            var dd = [];
            $.each(ImpData, function (index,value) {
                var inner = {Id: value.id, text:value.text};
                dd.push(inner);
            });
            var statusElement = args.element.querySelector('#ImplementId');
            if (!statusElement.classList.contains('e-dropdownlist')) {
                var dropDownListObject = new ej.dropdowns.DropDownList({
                    placeholder: 'Choose status', value: args.data.ImplementId,
                    fields: { text: 'text', value: 'Id' },
                    dataSource: dd
                });
                dropDownListObject.appendTo(statusElement);
                statusElement.setAttribute('name', 'ImplementId');
            }
            var startElement = args.element.querySelector('#StartTime');
            if (!startElement.classList.contains('e-datetimepicker')) {
                new ej.calendars.DateTimePicker({ value: new Date(startElement.value) || new Date() }, startElement);
            }
            var endElement = args.element.querySelector('#EndTime');
            if (!endElement.classList.contains('e-datetimepicker')) {
                new ej.calendars.DateTimePicker({ value: new Date(endElement.value) || new Date() }, endElement);
            }
        }
    };


Karthigeyan Krishnamurthi [Syncfusion]
Replied On April 29, 2019 08:51 AM UTC

Hi Tirathpal,  
 
Thanks for your update. 
 
In your code example, back end data is assigned to drop down via ViewBag which is correct. And DataManager also used to call the back end function, to fetch the data. 
 
Regards, 
Karthi 


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.

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

Live Chat Icon For mobile
Live Chat Icon