Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Not Able to bind the Lookup to data container

Posted on by 155

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans