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

Error in group method with MobileListView

3 Answers 85 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Armando
Top achievements
Rank 1
Armando asked on 04 Mar 2014, 04:14 PM
Hello everyone's, I'm getting an JS error when I want implement an group function into the MobileListView, I'm not sure what I need do to fix it, and it is only showing with the group method, this error happen in IE and Chorme and Firefox
This the error:


   Unhandled exception at line 11, column 1845 in http://localhost:65186/Scripts/Kendo/kendo.mobile.min.js
Uncaught TypeError: Cannot read property 'length' of undefined

This is my Mobile List View

@(Html.Kendo().MobileListView<IDigitales.RadBook.Web.Models.StudyViewModel>()
            .Name("listview")
            .TemplateId("tmp")
            .HeaderTemplateId("htmp")
            .FixedHeaders(true)
            .Style("inset")
            .DataSource(datasource =>
                datasource
                    .Read(read => read.Action("Studies","Home").Data("searchparameter"))
                    .PageSize(10)
                    .Group(g=>g.Add(m=>m.PatientName))
                    )
            )


and these are my templates:

<script type="text/x-kendo-template" id="tmp">
    <div data-role="content" style="width:100%;">
    <table style="width:100%; border-width:2px;">
    <tr  style="border-width:thin;">
      <td style="width:33%">
          #: PatientName #
      </td>
      <td style="width:33%">
          #: Modality #
      </td>
      <td style="width:33%">
          #: StudyDate #
      </td>
      <td>
          <div style="background-color:WhiteBlue;">
                Status Report
          </div
      </td>
      <td    style="right:0px; width:33%">
       <div style="position:relative; right:0px;">
          <a data-role="button" class="view" data-click="onClick" id="#=StudyId#">View</a>
       </div>
      </td>
    </tr>
    <tr>
    <td>
      #: Description #
    </td>
    </tr>
    <table>
      
    <div>
</script>
   
<script type="text/x-kendo-template" id="htmp">
    #: PatientName #
</script>

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 05 Mar 2014, 02:00 PM
Hello Armando,

I can see that a colleague of mine already answered your question in your support request. For your convenience I will copy the answer here as well:

This error usually appear when you are not returning the server response in correct format. You can verify whether the code in the `Studies` action method returners processed data, i.e return Json(<your data collection>.ToDataSourceResult(request));  as in  step 3 here.

http://docs.telerik.com/kendo-ui/getting-started/using-kendo-with/aspnet-mvc/helpers/mobilelistview/overview#data-binding

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Armando
Top achievements
Rank 1
answered on 12 Mar 2014, 06:21 AM
Thank you for the information, however I'm getting a new error when I'm  trying to use endless scrolling with grouping in a mobilelistview, the error is this: "ReferenceError: Description is not defined" and not display the data, I was debuggin the code  and I check that the properties exist into the list, so I don't understand why I'm getting
that error.
This my mobile List view

 
@(Html.Kendo().MobileListView()
                .Name("listview")
                .TemplateId("tmp")
                .HeaderTemplateId("htmp")
                .EndlessScroll(true)
                .ScrollTreshold(50)
                .DataSource(datasource => datasource
                            .Read(r => r.Action("Study_Read", "Home").Data("searchparameter"))
                            .PageSize(20)
                            .ServerOperation(true)
                            .Group(g => g.Add("PatientName", typeof(string)))
                            )
            )

and here is my templates
<script type="text/x-kendo-template" id="tmp">
        <div data-role="content" style="width:100%;">
        <table style="width:100%; border-width:2px;">
        <tr  style="border-width:thin;">
          <td style="width:33%">
              #=Description #
          </td>
          <td style="width:33%">
              #=Modality #
          </td>
          <td style="width:33%">
              #=StudyDate #
          </td>
          <td>
              <div style="background-color:WhiteBlue;">
                    Status Report
              </div>
          </td>
          <td    style="right:0px; width:33%">
           <div style="position:relative; right:0px;">
              <a data-role="button" class="view" data-click="onClick" id="#=StudyId#">View</a>
           </div>
          </td>
        </tr>
        
        </table>
         
        </div>
  </script>
  <script type="text/x-kendo-template" id="htmp">
       <p><h4> #= value #</h4> </p>
  </script>

here is the anonimus function in js that I'm getting the error
function anonymous(data) {
var o,e=kendo.htmlEncode;with(data){o='\n          <div data-role="content" style="width:100%;">\n          <table style="width:100%; border-width:2px;">\n          <tr  style="border-width:thin;">\n            <td style="width:33%">\n                '+(Description )+' \n            </td>\n            <td style="width:33%">\n                '+(Modality )+' \n            </td>\n            <td style="width:33%">\n                '+(StudyDate )+' \n            </td>\n            <td>\n                <div style="background-color:WhiteBlue;">\n                      Status Report\n                </div>\n            </td>\n            <td    style="right:0px; width:33%">\n             <div style="position:relative; right:0px;">\n                <a data-role="button" class="view" data-click="onClick" id="'+(StudyId)+'">View</a>\n             </div>\n            </td>\n          </tr>\n         \n          </table>\n          \n          </div>\n    ';}return o;
}

I checked the data parameter to see if the property was in, and I found the property, you can watch in my attached image, so could you please help with this issue
0
Kiril Nikolov
Telerik team
answered on 12 Mar 2014, 01:12 PM
Hello Armando,

Using grouping and endless scrolling together in a mobile ListView is not supported, so the problems that you face are expected. I am afraid that we are not able to provide you with a workaround for this.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ListView (Mobile)
Asked by
Armando
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Armando
Top achievements
Rank 1
Share this question
or