triniwiz / nativescript-accordion

Apache License 2.0
38 stars 14 forks source link

issue in item rendering #28

Closed chauhan-saurabh closed 6 years ago

chauhan-saurabh commented 6 years ago
11-18 14:04:46.914  7562  7562 E AndroidRuntime:        at com.tns.Runtime.callJSMethodNative(Native Method)
11-18 14:04:46.914  7562  7562 E AndroidRuntime:        at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
11-18 14:04:46.914  7562  7562 E AndroidRuntime:        at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
11-18 14:04:46.914  7562  7562 E AndroidRuntime:        at com.tns.Runtime.callJSMethod(Runtime.java:957)
11-18 14:04:46.914  7562  7562 E AndroidRuntime:        at com.tns.Runtime.callJSMethod(Runtime.java:941)
11-18 14:04:46.914  7562  7562 E AndroidRuntime:        at com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err: com.tns.NativeScriptException:
System.err: Calling js method getChildrenCount failed
System.err:
System.err: TypeError: Cannot read property 'length' of undefined
System.err: File: "file:///data/data/org.nativescript.shyft/files/app/tns_modules/nativescript-accordion/src/android/accordion.js, line: 296, column: 67
System.err:
System.err: StackTrace:
System.err:     Frame: function:'AccordionListAdapter.getChildrenCount', file:'file:///data/data/org.nativescript.shyft/files/app/tns_modules/nativescript-accordion/src/android/accordion.js', line: 296, column: 68
System.err:
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err:     at com.tns.gen.android.widget.BaseExpandableListAdapter_frnal_ts_helpers_l58_c38__AccordionListAdapter.getChildrenCount(BaseExpandableListAdapter_frnal_ts_helpers_l58_c38__AccordionListAdapter.java:67)
System.err:     at android.widget.ExpandableListConnector.refreshExpGroupMetadataList(ExpandableListConnector.java:563)
System.err:     at android.widget.ExpandableListConnector.expandGroup(ExpandableListConnector.java:688)
System.err:     at android.widget.ExpandableListView.handleItemClick(ExpandableListView.java:693)
System.err:     at android.widget.ExpandableListView.performItemClick(ExpandableListView.java:653)
System.err:     at android.widget.AbsListView$PerformClick.run(AbsListView.java:3134)
System.err:     at android.widget.AbsListView$3.run(AbsListView.java:4049)
System.err:     at android.os.Handler.handleCallback(Handler.java:789)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:98)
System.err:     at android.os.Looper.loop(Looper.java:164)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6541)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
westlakem commented 6 years ago

@chauhan-saurabh so after looking at the documentation a little closer, it's expected all of the things to be rendered by the accordion to be in an items array

this.items = [
      {
        title: "1", footer: "10", headerText: "First", footerText: "4",
        items: [  **//<---------THIS IS WHAT YOU'RE MISSING---------**
          { image: "~/images/a9ff17db85f8136619feb0d5a200c0e4.png", text: "Stop" },
          { text: "Drop", image: "http://static.srcdn.com/wp-content/uploads/Superman-fighting-Goku.jpg" }
        ]
      }
    ]