Hello,
I have a function which constructs Observable ViewModel. In that there are 4-5 dataSource.
function
GetAirRequestMVVMTemplate() {
debugger;
//kendo.ui.progress($("body"), true);
var
airRequestViewModel = kendo.observable({
FlightDestinationSource:
function
(e) {
return
new
kendo.data.DataSource({
transport: {
read: {
url: rootUrl(
"GetData/GetCountry"
),
dataType:
"json"
}
},
serverFiltering:
true
});
},
FlightOriginSource:
function
(e) {
return
new
kendo.data.DataSource({
transport: {
read: {
url: rootUrl(
"GetData/GetCountry"
),
dataType:
"json"
}
},
serverFiltering:
true
});
},
ViaSource:
function
(e) {
debugger;
var
viadata = e.ArriveDepartDetails.via;
return
new
kendo.data.DataSource({
transport: {
read: {
url: rootUrl(
"GetData/GetCountry"
),
dataType:
"json"
,
data:
function
(e) {
return
{
adddata: JSON.stringify(viadata)
//viadata != null ? JSON.stringify(viadata) : JSON.stringify([])
};
}
}
},
serverFiltering:
true
});
},
AirlineIdsSource:
function
(e) {
debugger;
var
airdata = e.AirlineIds;
return
new
kendo.data.DataSource({
transport: {
read: {
url: rootUrl(
"GetData/GetAirLines"
),
dataType:
"json"
,
data:
function
(e) {
return
{
data: JSON.stringify(airdata)
};
}
}
},
serverFiltering:
true
});
},
ClassSource:
function
(e) {
return
new
kendo.data.DataSource({
transport: {
read: {
url: rootUrl(
"GetData/Get_Air_Class_Details"
),
dataType:
"json"
}
}
});
},
AllianceSource:
function
(e) {
return
new
kendo.data.DataSource({
transport: {
read: {
url: rootUrl(
"GetData/GetAlliance"
),
dataType:
"json"
}
}
});
},
TimeTypeSource:
function
(e) {
return
new
kendo.data.DataSource({
data: [
{ Text:
"None"
, Value:
"-1"
},
{ Text:
"Departs"
, Value:
"D"
},
{ Text:
"Arrives"
, Value:
"A"
}
]
});
},
TimeTypeDataBound:
function
(e) {
debugger;
if
(e.data.ArriveDepartDetails.TimeType ==
null
) {
e.data.ArriveDepartDetails.set(
"TimeType"
,
"-1"
);
}
},
OnOpenOriginAutoComplete:
function
(e) {
debugger;
var
target = $(e.sender.element).data(
"kendoAutoComplete"
);
target.list.width(280);
},
SaveAirRequest:
function
(e) {
debugger;
if
($(
"#APISForm"
).kendoValidator().data(
"kendoValidator"
).validate()) {
if
(validateAirRequestForm()) {
kendo.ui.progress($(
"#AirRequest"
),
true
);
var
data = {
airRequestData: e.data
//AirRequestViewModel.AirItem.AirVMList
}
$.ajax({
type:
"POST"
,
contentType:
"application/json; charset=utf-8"
,
traditional:
true
,
data: JSON.stringify(data),
url: rootUrl(
"SearchAvailability/AirRequestMVVMSave"
),
success:
function
(response) {
debugger;
if
(response.Error ==
null
) {
RefreshServiceElements();
$(
"#AirRequest"
).data(
"kendoWindow"
).close();
}
else
{
ShowKendoMessage(
"Error: "
+ response.Error);
AirRequestViewModel.AirItem.AirVMList.Error =
null
;
}
kendo.ui.progress($(
"#AirRequest"
),
false
);
}
});
}
}
else
{
ShowKendoMessage(
"Please Enter Required Fields"
);
}
},
AddSegment:
function
(e) {
debugger;
// this.AirVMList.SegmentInfo.push(new this.AirVMList.SegmentInfo());
//AirRequestViewModel.AirItem.AirVMList.SegmentSkeleton
var
object = JSON.stringify(AirRequestViewModel.AirItem.AirVMList.SegmentSkeleton);
object = JSON.parse(object);
AirRequestViewModel.AirItem.AirVMList.SegmentInfo.splice(parseInt(e.data.index + 1), 0, object);
var
prevDestination = AirRequestViewModel.AirItem.AirVMList.SegmentInfo[parseInt(e.data.index)].ArriveDepartDetails.Destination;
AirRequestViewModel.AirItem.AirVMList.SegmentInfo[parseInt(e.data.index + 1)].ArriveDepartDetails
.set(
"Origin"
, prevDestination);
//AirRequestViewModel.AirItem.AirVMList.SegmentInfo.push(AirRequestViewModel.AirItem.AirVMList
// .SegmentSkeleton);
for
(
var
i = 0; i < AirRequestViewModel.AirItem.AirVMList.SegmentInfo.length; i++) {
this
.AirVMList.set(
"SegmentInfo["
+ i +
"].index"
, i);
}
},
RemoveSegment:
function
(e) {
debugger;
AirRequestViewModel.AirItem.AirVMList.SegmentInfo.splice(e.data.index, 1);
for
(
var
i = 0; i < AirRequestViewModel.AirItem.AirVMList.SegmentInfo.length; i++) {
this
.AirVMList.set(
"SegmentInfo["
+ i +
"].index"
, i);
}
},
ShowSegmentOptions:
function
(e) {
debugger;
},
FlightOriginOnOpen:
function
(e) {
debugger;
//var target = $(e.sender.element).data("kendoDropDownList");
//target.list.width(280);
},
ResetAirItem:
function
(e) {
debugger;
e.data.ArriveDepartDetails.set(
"Origin"
,
null
);
e.data.ArriveDepartDetails.set(
"Destination"
,
null
);
e.data.ArriveDepartDetails.set(
"DepartureDate"
,
null
);
e.data.ArriveDepartDetails.set(
"TimeType"
,
"-1"
);
e.data.ArriveDepartDetails.set(
"DepartureTime"
,
"00:00"
);
e.data.ArriveDepartDetails.set(
"via"
, []);
e.data.set(
"AirlineIds"
, []);
e.data.set(
"ClassCodeId"
,
null
);
e.data.set(
"FlightNumber"
,
null
);
e.data.set(
"Alliance"
,
null
);
e.data.set(
"Note"
,
null
);
},
HideSegmentOptions:
function
(e) {
debugger;
$(e.toElement).closest(
".segmentdiv"
).find(
".tobehidden"
).toggle();
$(e.toElement).closest(
".segmentdiv"
).find(
"#flipdown"
).toggle();
$(e.toElement).closest(
".segmentdiv"
).find(
"#flipup"
).toggle();
},
CancelAirRequest:
function
(e) {
debugger;
$(
"#AirRequest"
).data(
"kendoWindow"
).close();
}
});
$.when(
$.ajax({
url: rootUrl(
"SearchAvailability/GetAirRequestJSONData"
),
type:
"POST"
,
dataType:
"json"
,
data: { requestId: $(
"#RequestID"
).val() }
}),
loadTemplate(
"Content/Templates/AirRequestViewModelNew.tmpl.htm"
)
)
.then(onAirRequestWindowSuccess(airRequestViewModel))
.fail(onAirRequestWindowFailure);
}
All Datasource to etc. When select option any autocomplete or all other send read/filter request to . I know why its happening.
Hi People, I am using grids popup editor to edit the grid row. in that I am using custom editor (DropDown control) for some of field of Grid. Following is code for that Dropdown editor:
function prontoStratumDropDownEditor(container, options) {
$('<input required data-text-field="ABC" data-value-field="XYZ" name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
dataSource: new kendo.data.DataSource({
transport: {
read: {
url: "SomeURL",
type: "get",
datatype: "json",
}
}
}),
filter: "startswith",
suggest: true,
}
});
}
When I click on Edit Command of Grid, ideally dropdown should show me the name of already existing field For Eg: if grid row contain value "Animal" then when I click on Edit, by default DropDown should have "Animal" selected, but its not. I tried many things like getting rid of name property, remove required attribute etc but I do not know Why it is not showing me can anyone please help?
Hi guys, im having problem with these styles.i dont know what i could do anymore, any solution?
I have a request to create a widget that shows the next X upcoming events using MVC/C#. I figured the easiest way would be to create a ListView that pulls from the scheduler's datastore and take top X.
How can we tap into the logic of the scheduler to generate events from the event definitions/rules (e.g. handle recurrence rules, recurrence exceptions, timezones, etc)? I would think we can use the data from the schedulers datastore to generate events between now and an end date and take the next X upcoming.
If this is not possible, I assume we'd have to go down a more complex solution by using the scheduler with a custom view (like an agenda view) but I'd need to figure out how to show only the next X events and not all of them between two dates.
Hey guys,
I'm trying to use the aggregation feature on the kendo grid control. But every time I got next error
"Uncaught ReferenceError: count is not defined error"
Here is the demo
https://dojo.telerik.com/imUVev
Please help since we have no longer confidence in kendo and we might use another library of components.
The custom validation on a numeric field is not working after using setOptions. In the setOptions we are adding new numeric fields with custom validation between 0 and 100.
The below is a sample that I tried to implement to show our case:
https://dojo.telerik.com/egawE
Thank you in advance
Why doesn't re-binding a grid re-bind all of the filters that are associated with it?!
I have a grid that is populated with an MVC call that gets all the requests for a department or departments. The department drop-down is a multi-select drop-down and the grid is populated on a button click that gets all department IDs from the drop-down and runs the MVC call. The filter works exactly one time. The first time the button is clicked. If I change the department(s) in the drop-down and run the call again. The grid refreshes with the new data, but the filter on the "Funding" column (happens to be a multi-select filter) still shows the values from the first time the grid was loaded.