Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

How to set retrivemultiple result data to data source of Kendo grid?

(0) ShareShare
ReportReport
Posted on by 55
I have use this HTML web resource to show 'Queue I am member of' data to table and I want to implement code to get default queue value and change the default value as per the radio button selected value which is the  'Queue I am member of'  data. I need help to set retrieve multiple data into dataSource of kendo grid. I think we get json data for result but not able to see the result as I need
<html>
  <head>
    <meta charset="utf-8" />
    <title>Download Table</title>

    <link
      rel="stylesheet"
    />

    <script src="code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="kendo.cdn.telerik.com/.../kendo.all.min.js"></script>
    <meta />
    <meta />
  </head>
  <body onfocusout="parent.setEmailRange();" style="overflow-wrap: break-word">
    <div id="grid"></div>
    <script type="text/javascript">
      debugger;
      var jsonData;
      $(document).ready(function () {
        var queueFetchXML =
          "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
          "  <entity name='queue'>" +
          "    <attribute name='name'/>" +
          "    <attribute name='queueid'/>" +
          "    <order attribute='name' descending='false'/>" +
          "    <link-entity name='queuemembership' from='queueid' to='queueid' visible='false' intersect='true'>" +
          "      <link-entity name='systemuser' from='systemuserid' to='systemuserid' alias='ab'>" +
          "        <filter type='and'>" +
          "          <condition attribute='systemuserid' operator='eq-userid'/>" +
          '        </filter>' +
          '      </link-entity>' +
          '    </link-entity>' +
          '  </entity>' +
          '</fetch>';

        queueFetchXML = '?fetchXml=' + encodeURIComponent(queueFetchXML);

        window.parent.Xrm.WebApi.retrieveMultipleRecords(
          'queue',
          queueFetchXML
        ).then(function success(result) {
          debugger;

          jsonData = result.entities;
          console.log('json inside xrm: ' + jsonData);
        });
        console.log('json outside xrm: ' + jsonData);

        $('#grid').kendoGrid({
          dataSource: {
            data: jsonData,
            type: 'odata',
            transport: {
              read: 'demos.telerik.com/.../Orders',
            },
            schema: {
              model: {
                fields: {
                  name: { type: 'string' },
                },
              },
            },
          },

          columns: [
            {
              field: 'name',
              title: `Queue I'm a member of`,
              width: 150,
            },

            {
              title: 'Default Queue',
              width: 150,
              template: "<input type='radio' id='manualTab' name='manualTab' >",
            },
          ],
          dataBound: function (e) {
            debugger;
            $("input[name='manualTab']").on('click', function (e) {
              var grid = $('#grid').data('kendoGrid');
              var dataItem = grid.dataItem($(e.target).closest('tr'));
              alert(dataItem.name);
            });
          },
        });
      });
    </script>
  </body>
</html>
  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: How to set retrivemultiple result data to data source of Kendo grid?

    Hello,

    I would recommend to convert the collection you received as a response to an array of objects and use setDataSource method of the grid - docs.telerik.com/.../setdatasource

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans