钛工作室向部分添加行
我看不出我在这里做错了什么。简而言之,我想将自定义行添加到一个部分,将该部分添加到表视图,然后在我的窗口中显示该视图。听起来很容易。我已经多次浏览我的代码,以至于我再也看不到我错过了什么(我想我们都经历过)。所以我需要一双新的眼睛来看待它。
首先,我知道我将数据放入行中。我通过服务器成功回调中的 for 循环将该行添加到该部分。我没有收到任何错误。该部分出现在窗口中。但我根本无法显示行。
为了避免转储此块中的代码,您可以在此处粘贴它。
如果您需要更多信息,请随时询问。
谢谢。
I cannot see what I am doing wrong here. Simply put, I want to add custom row to a section, add the section to a table view, then display the view in my window. Sounds easy enough. I've stepped through my code so many times that I can no longer see what I'm missing (I think we've all been there). So I need a fresh set of eyes to look at it.
First, I know I get data into the row. I add the row to the section via a for loop in the success callback from the server. I get no errors. The section appears in the window. But I simply cannot get the rows to display.
To avoid dumping the code in this block, you can find it pasted here.
If you need more information, please feel free to ask.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
哇,
这是一个很难解决的问题。我的一位消息灵通的同事在周末解决了这个问题。
而不是向父级推送和添加元素。他只是使用appendRow 方法将一行添加到一个空数组中,然后将其添加到表视图中。
首先创建表视图:
然后在回调中,迭代并追加到添加到视图中的数组:
请注意,重要的部分是表视图中的 data : [],; data 属性的空数组。希望这可以帮助别人避免这给我带来的头痛。
Wow,
This was a tough nut to crack. One of my more-informed colleagues solved it over the weekend.
Rather than pushing and adding elements to the parent. He simply used the appendRow method to add a row to an empty array which then was added to the table view.
Create the table view first:
Then in the callback, iterate and append to the array which is added to the view:
Note that the important piece is data : [], in the tableview; the empty array for the data property. Hope this helps someone avoid the headache this caused me.
这也应该有效
this should work too