Dear Experts,
I have written This code for to bind the lookup in Kendo grid
1.this is my column
columnArray.push(
{
name: "pcl_typeofdealer",
type: "EntityReference",
editable: false,
title: "Type of Dealer",
width: "35px",
editor: "TypeofDealer"
});
2.in this function am binding the data to container
function TypeofDealer(container, options) {
debugger;
jQuery('<input data-text-field="formattedValue" data-value-field="value" data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList(
{
dataTextField: "formattedValue",
dataValueField: "value",
dataSource: RetrieveEntityRefferenceAttributeMetaDataTOD(options.field),
optionLabel: {
formattedValue: "",
value: 0,
type: "EntityReference"
}
});
}
3.Here am retriving the mata data
function RetrieveEntityRefferenceAttributeMetaDataTOD(field) {
debugger;
var EntityReferenceMetadata = new Array();
try {
var EntityCollection = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+
"<entity name='lead'>"+
"<attribute name='fullname' />"+
"<attribute name='companyname' />"+
"<attribute name='telephone1' />"+
"<attribute name='leadid' />"+
"<order attribute='fullname' descending='false' />"+
" </entity>"+
"</fetch>"
return EntityCollection;
EntityReferenceMetadata.push(EntityReference);
}
catch (e)
{
alert("RetrieveEntityRefferenceAttributeMetaDataTOD: " + e.message);
}
return EntityCollection;
}
4.here is my Kendo html code
<script type="text/javascript">
// debugger;
var viewColumns = AlertConfigurationView();
jQuery(document).ready(function () {
ConfigdataSource = new kendo.data.DataSource({
transport: {
read: function (o) {
o.success(RetrieveRecords());
},
create: function (o) {
debugger;
createRecord(o);
o.success(o.data);
jQuery("#subdiv1").data('kendoGrid').dataSource.read();
jQuery("#subdiv1").data('kendoGrid').refresh();
},
// save: function (options) {
//saveRecord(options, options.data.activityid);
//options.success(options.data);
//jQuery("#subdiv1").data('kendoGrid').dataSource.read();
//jQuery("#subdiv1").data('kendoGrid').refresh();
//},
update: function (options) {
updateRecord(options, options.data.activityid);
options.success(options.data);
jQuery("#subdiv1").data('kendoGrid').dataSource.read();
jQuery("#subdiv1").data('kendoGrid').refresh();
},
destroy: function (options) {
// debugger;
deleteRecord(options.data.activityid);
options.success(options.data);
jQuery("#subdiv1").data('kendoGrid').dataSource.read();
jQuery("#subdiv1").data('kendoGrid').refresh();
}
},
batch: false,
schema: {
model:
{
id: "activityid",
fields: GetColumnsModel(viewColumns)
}
},
pageSize: 10
});
var grid = jQuery("#subdiv1").kendoGrid({
dataSource: ConfigdataSource,
toolbar: ["create", "save"],
columns: GetColumnSetArray(viewColumns),
height: "100%",
width: "100%",
pageable: true,
sortable: true,
autoBind: true,
//resizable: true,
// selectable: "row",
editable: "inline"
});
});
</script>
Here am not be able to bind the lookup field to the data container can any one help me
thanks
regards
shankar
*This post is locked for comments