Widget 2.0 - TableView insertRow id

Hi, I’m trying to make my app work with the widget 2.0 and, among the many issues I’m fixing, there’s one I can’t find a solution.

In the insertRow method of TableView, there is an option called “id” to pass an optional id to a table view row.
Before widget 2.0 I could store any value (string or tables) in this id parameter, and then I was able to retrieve it in the rowRender. Now, I can’t find it anywhere.
The custom id parameter is not returned in the rowRender listener on event.row. [import]uid: 9158 topic_id: 36210 reply_id: 336210[/import]

Hey PXL.

You are correct. Would you be so kind as to file a bug about this so I can keep track of it here?: http://developer.coronalabs.com/content/bug-submission

You don’t need to provide a test case, just the information you posted in this thread is more than enough.

Thank you [import]uid: 84637 topic_id: 36210 reply_id: 143839[/import]

Ok, submitted.
By the way, I see in the documentation and examples of the new tableView, a event.phase returned from listener, onRowTouch and onRowRender.
I think there’s no event.phase on a onRowRender (returns nil).

[import]uid: 9158 topic_id: 36210 reply_id: 143840[/import]

Thanks.

I will look into that also, and again if you would report a bug on that also great!
Thanks for the reports, it will help get these teething problems sorted out asap. [import]uid: 84637 topic_id: 36210 reply_id: 143841[/import]

Hey PXL.

You are correct. Would you be so kind as to file a bug about this so I can keep track of it here?: http://developer.coronalabs.com/content/bug-submission

You don’t need to provide a test case, just the information you posted in this thread is more than enough.

Thank you [import]uid: 84637 topic_id: 36210 reply_id: 143839[/import]

Ok, submitted.
By the way, I see in the documentation and examples of the new tableView, a event.phase returned from listener, onRowTouch and onRowRender.
I think there’s no event.phase on a onRowRender (returns nil).

[import]uid: 9158 topic_id: 36210 reply_id: 143840[/import]

Thanks.

I will look into that also, and again if you would report a bug on that also great!
Thanks for the reports, it will help get these teething problems sorted out asap. [import]uid: 84637 topic_id: 36210 reply_id: 143841[/import]

Hi

I am having the same problem. I can’t see a way of looping data into a TableView now. Before I would have just passed the data as a table in the id field.

Is there a workaround or an ETA for a fix please?

Thank you

Dougi [import]uid: 155864 topic_id: 36210 reply_id: 145185[/import]

Hey guys,

I wasn’t aware the sample was broken, will get it fixed.

There is already a id that can be assigned to tableView rows ( from daily build 1040 onwards ),

tableView:insertRow{ id = "whateverIdYouWant", } [import]uid: 84637 topic_id: 36210 reply_id: 145186[/import]

Ooo, thanks, that sounds like it may solve it. I’m on build 1038, so I’ll update.

Does it support passing a table of values?

Thanks so so much for your quick response. You guys are great! [import]uid: 155864 topic_id: 36210 reply_id: 145187[/import]

@Doug, it should do :wink: [import]uid: 84637 topic_id: 36210 reply_id: 145189[/import]

Thanks Danny. I think I am being thick here, but I am not sure where I am going wrong. I have the following and am using the latest daily build 2013.1043


local widget = require “widget”

local function onRowRender(event)
print(event.id)
end

local list = widget.newTableView
{
width = display.contentWidth,
height = display.contentHeight,
onRowRender = onRowRender,
}

for i = 1, 20 do
list:insertRow
{
id = “this is my variable”,
height=60,
lineColor={115, 185, 255},
}
end


I get a print out of the looped items, but the print just says “nil” e.g.

2013-03-06 14:57:34.395 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.395 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.396 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.396 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.396 Corona Simulator[5222:707] nil
etc

If I try and add the onRender to the insertRow it doesn’t do anything at all.

Could you please show me what I’m doing wrong here?

Thank you and sorry if this is a basic question.

Dougi
[import]uid: 155864 topic_id: 36210 reply_id: 145193[/import]

There is no longer event.id.

In your row render function you should have something like this:

[code]
local row = event.target

print( row.id ) – this is the row id
[/code] [import]uid: 84637 topic_id: 36210 reply_id: 145195[/import]

Thank you. I tried that before as well, but when I do that I just get:

2013-03-06 16:23:16.875 Corona Simulator[5222:707] widget_tableView
2013-03-06 16:23:16.876 Corona Simulator[5222:707] widget_tableView
2013-03-06 16:23:16.876 Corona Simulator[5222:707] widget_tableView
2013-03-06 16:23:16.876 Corona Simulator[5222:707] widget_tableView
etc

The code being:


local widget = require “widget”

local function onRowRender(event)
local row = event.target

print( row.id ) – this is the row id
end

local list = widget.newTableView
{
width = display.contentWidth,
height = display.contentHeight,
onRowRender = onRowRender,
}

for i = 1, 20 do
list:insertRow
{
id = “this is my variable”,
height=60,
lineColor={115, 185, 255},
}
end


Should the above be returning the id that I have in my insertRow?

Thank you!

Dougi [import]uid: 155864 topic_id: 36210 reply_id: 145202[/import]

Hey Doug.

Sorry, I read your initial question wrong.

This is what you want:

local row = event.row  
  
print( row.id )  

Sorry about that. [import]uid: 84637 topic_id: 36210 reply_id: 145203[/import]

Hi

I am having the same problem. I can’t see a way of looping data into a TableView now. Before I would have just passed the data as a table in the id field.

Is there a workaround or an ETA for a fix please?

Thank you

Dougi [import]uid: 155864 topic_id: 36210 reply_id: 145185[/import]

Hey guys,

I wasn’t aware the sample was broken, will get it fixed.

There is already a id that can be assigned to tableView rows ( from daily build 1040 onwards ),

tableView:insertRow{ id = "whateverIdYouWant", } [import]uid: 84637 topic_id: 36210 reply_id: 145186[/import]

Ooo, thanks, that sounds like it may solve it. I’m on build 1038, so I’ll update.

Does it support passing a table of values?

Thanks so so much for your quick response. You guys are great! [import]uid: 155864 topic_id: 36210 reply_id: 145187[/import]

@Doug, it should do :wink: [import]uid: 84637 topic_id: 36210 reply_id: 145189[/import]

Thanks Danny. I think I am being thick here, but I am not sure where I am going wrong. I have the following and am using the latest daily build 2013.1043


local widget = require “widget”

local function onRowRender(event)
print(event.id)
end

local list = widget.newTableView
{
width = display.contentWidth,
height = display.contentHeight,
onRowRender = onRowRender,
}

for i = 1, 20 do
list:insertRow
{
id = “this is my variable”,
height=60,
lineColor={115, 185, 255},
}
end


I get a print out of the looped items, but the print just says “nil” e.g.

2013-03-06 14:57:34.395 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.395 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.396 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.396 Corona Simulator[5222:707] nil
2013-03-06 14:57:34.396 Corona Simulator[5222:707] nil
etc

If I try and add the onRender to the insertRow it doesn’t do anything at all.

Could you please show me what I’m doing wrong here?

Thank you and sorry if this is a basic question.

Dougi
[import]uid: 155864 topic_id: 36210 reply_id: 145193[/import]