- Home
- Forum
- ASP.NET MVC - EJ 2
- cannot read property groupid of undefined
cannot read property groupid of undefined
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>
SIGN IN To post a reply.
6 Replies
VD
Vinitha Devi Murugan
Syncfusion Team
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.
TI
tirathpal
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
NR
Nevitha Ravi
Syncfusion Team
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
TI
tirathpal
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
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 undefinedthis 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.
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);
}
}
};
KK
Karthigeyan Krishnamurthi
Syncfusion Team
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.
https://ej2.syncfusion.com/javascript/documentation/drop-down-list/data-binding/#binding-remote-data
Regards,
Karthi
SIGN IN To post a reply.
- 6 Replies
- 4 Participants
-
TI tirathpal
- Apr 24, 2019 06:06 AM UTC
- Apr 29, 2019 08:51 AM UTC