This is a migrated thread and some comments may be shown as answers.

How Can pass selected rows on Kendo ui grid to telerik report ?

3 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 2
Ahmed asked on 01 May 2015, 09:26 PM

Hi

i have an kendo ui grid and i need to pass selected rows in my grid to report to let me print them from report 

i try to find any thing like that in demo but i faild

so please hope to give me sample code or sample example to let know how can i do that

 thanks a lot ....

 

        @(Html.Kendo()
              .Grid<kind>()
              .Name("kinds_")
              .Columns(columns =>
              {
                  columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' #= kind_id ? checked='':'checked' # class='chkbx' />");
                  columns.Bound(e => e.kind_name).Width(300).Title("اسم المجموعه الرئيسيه");
 
                  columns.Command(command =>
                  {
                      command.Edit()
                             .Text("تعديل")
                             .UpdateText("حفظ")
                             .CancelText("الغاء");
                      command.Destroy().Text("حذف");
                  });
              })
              .Filterable(filterable => filterable.Operators(operators => operators.ForString(str => str.Clear().StartsWith("يبدء بـ").IsEqualTo("يساوى").IsNotEqualTo("لا يساوى").Contains("يحتوي علي").DoesNotContain("لا يحتوي علي"))).Operators(operators => operators
                                                                                                                                                                                                                                                                          .ForNumber(str => str.Clear().IsEqualTo("يساوى").IsNotEqualTo("لا يساوى").IsGreaterThanOrEqualTo("أكبر من أو يساوى").IsGreaterThan("أكبر من").IsLessThanOrEqualTo("أقل من أو يساوى").IsLessThan("أقل من"))).Messages(m => m.And("و")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     .Or("أو")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     .Filter("بحث")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     .Clear("إلغاء")
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     .Info("حدد فلتر البحث الذى تريده")))
              .ToolBar(tools => tools.Create().Text("اضافه مجموعه رئيسيه جديده"))
 
        @* السطر ده عشان تخلى التعديل عن طريق PopUp *@
              .Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.PopUp).TemplateName("AddEditkind"))
         
              .Pageable()
              .Sortable()
              .Filterable()
              .DataSource(source => source.Ajax()
                                          .Model(model =>
                                          {
                                              model.Id(e => e.kind_id);
                                          })
                     
                                          .Events(events => events.Error("error_handler"))
                                          .Read(read => read.Action("Read_kind", "kinds"))
                                          .Update(update => update.Action("Update_kind", "kinds"))
                                          .Create(create => create.Action("Create_kind", "kinds"))
                                          .Destroy(destroy => destroy.Action("Destroy_kind", "kinds")))
         
              .ClientDetailTemplateId("CategoriesTemplate")
        )
 
@section scripts
{
    <script type="text/javascript">
 
        $(function () {
            $('#kinds_').on('click', '.chkbx', function () {
                var checked = $(this).is(':checked');
                var grid = $('#kinds_').data().kendoGrid;
                var dataItem = grid.dataItem($(this).closest('tr'));
                dataItem.set('kind_id', checked);
            })
        })
 
        function error_handler(e) {
            productsTemplate
            if (e.errors) {
                var message = "Errors:\n";
                $.each(e.errors, function (key, value) {
                    if ('errors' in value) {
                        $.each(value.errors, function () {
                            message += this + "\n";
                        });
                    }
                });
                alert(message);
            }
        }
    </script>
}
 

 

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 05 May 2015, 10:29 AM
Hello Ahmed,

To pass data from a business object to a Telerik report you need to use the ObjectDataSource component. For more information on how to use this data source component, please refer to the ObjectDataSource Component help articles.
How to prepare the data before wrapping it in the ObjectDataSource will be specific to your application and you will need to invent your own method to do so.

A similar scenario has been discussed in the Pass RadGrid DataSource (dataSet)to Telerik Reporting? forum thread, which you might find useful.

Regards,
Nasko
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Ahmed
Top achievements
Rank 2
answered on 07 May 2015, 01:53 PM

Can you please give me sample example for that to let me fully understand it ?

 Thanks a lot ....

0
Stef
Telerik team
answered on 13 May 2015, 03:02 PM
Hi Ahmed,

The idea is that reports are processed and rendered on the server. Thus after finishing the data manipulation through the client-side grid widget all changes must be committed on the server. Then the report can use the from the server, where it is a matter of custom implementation how it will be accessed.

An example of accessing data via ObjectDataSource component is illustrated in Connecting Telerik Reporting to OData feeds.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ahmed
Top achievements
Rank 2
Answers by
Nasko
Telerik team
Ahmed
Top achievements
Rank 2
Stef
Telerik team
Share this question
or