awesome! thanks so much @jbverschoor_bloomsix worked like a charm [import]uid: 74667 topic_id: 24277 reply_id: 120385[/import]
That can also happen when you close / removeSelf() the whole scene or tableview.
You should check if the target is a valid displayobject before adding [import]uid: 5942 topic_id: 24277 reply_id: 120360[/import]
Hi there!,
Is it possible to know if a row hasn’t been de-rendered?
I am downloading images from facebook, first I load a default picture then I wait for the network.download listener to fire the new downloaded image.
Problem is that if the row has been de-rendered before the pic has been downloaded the rowGroup:insert(image) will make the following error: attempt to call method ‘insert’ (a nil value)
[code]
local function onRowRender( event ){
local rowGroup = event.view
local image
image = display.newImageRect(“defaultPic.png” ,50,50)
rowGroup:insert(image)
local function imageListener()
if ( event.isError ) then
print ( “Network error - download failed” )
else
image= display.newImageRect(“friend”… data[rowIndex].id …".png" ,system.TemporaryDirectory,50,50)
rowGroup:insert(image)
end
end
network.download( “http://graph.facebook.com/”… data[rowIndex].id …"/picture", “GET”,
imageListener, “friend”…data[rowIndex].id…".png", system.TemporaryDirectory )
} [/code]
any suggestions would be appreciated, as I don’t want to download all the images before generating the table rows. [import]uid: 74667 topic_id: 24277 reply_id: 120359[/import]
Line 11/13 -->
[lua]if rowGroup.numChildren then
image= display.newImageRect(“friend”… data[rowIndex].id …".png" ,system.TemporaryDirectory,50,50)
rowGroup:insert(image)
end[/lua] [import]uid: 5942 topic_id: 24277 reply_id: 120378[/import]
awesome! thanks so much @jbverschoor_bloomsix worked like a charm [import]uid: 74667 topic_id: 24277 reply_id: 120385[/import]
*deleted [import]uid: 29093 topic_id: 24277 reply_id: 122999[/import]
Has anyone come across a good way to implement “drag down to refresh” on tableviews?
Like the tableviews you quite often find on native iOS apps. [import]uid: 84115 topic_id: 24277 reply_id: 123001[/import]
*deleted [import]uid: 29093 topic_id: 24277 reply_id: 122999[/import]
Has anyone come across a good way to implement “drag down to refresh” on tableviews?
Like the tableviews you quite often find on native iOS apps. [import]uid: 84115 topic_id: 24277 reply_id: 123001[/import]
I am having the same problem. I can get the tableview to rotate with tv.rotation= but the scrolling is off. How can I rotate the scrolling as well as the view?
I am trying to create a dropdown list of languages a user can select.
User pushed the Language button and the tableview appears with the list of languages to select.
I also notice that when a row is selected in landscape it always shows as item 1 selected regardless of which item I select.
Very fustrating. Been working this for 3 days now and can not find a solution.
If anyone has any ideas on how to do what I want using some other method I’m all ears.
Devices rotate, simple fact of life. Making sure all display objects and widgets rotate properly should be a priority.
Chris Rennie [import]uid: 180235 topic_id: 24277 reply_id: 125613[/import]
I am having the same problem. I can get the tableview to rotate with tv.rotation= but the scrolling is off. How can I rotate the scrolling as well as the view?
I am trying to create a dropdown list of languages a user can select.
User pushed the Language button and the tableview appears with the list of languages to select.
I also notice that when a row is selected in landscape it always shows as item 1 selected regardless of which item I select.
Very fustrating. Been working this for 3 days now and can not find a solution.
If anyone has any ideas on how to do what I want using some other method I’m all ears.
Devices rotate, simple fact of life. Making sure all display objects and widgets rotate properly should be a priority.
Chris Rennie [import]uid: 180235 topic_id: 24277 reply_id: 125613[/import]
I added a row “rerender” called onRowRefresh that lets me update a row with new values. Note, I’ve used a fade in/out — you’ll have to write those functions.
[code]
– handles individual row refresh
local function onRowRefresh ( row )
local rowGroup = row.view
local function postfade()
– remove current display obj of row
rowGroup.displayItem:removeSelf()
rowGroup.displayItem = nil
– build it again
local displayItem = buildOneRowItem(row)
rowGroup:insert( displayItem )
rowGroup.displayItem = displayItem
funx.fadeIn(row.view)
end
funx.fadeOut(row.view, postfade)
end
– handles individual row rendering
local function onRowRender( event )
local row = event.row
local rowGroup = event.view
local displayItem = buildOneRowItem(row)
row.onRowRefresh = onRowRefresh
rowGroup:insert( displayItem )
rowGroup.displayItem = displayItem
end
[/code] [import]uid: 37366 topic_id: 24277 reply_id: 129676[/import]
I added a row “rerender” called onRowRefresh that lets me update a row with new values. Note, I’ve used a fade in/out — you’ll have to write those functions.
[code]
– handles individual row refresh
local function onRowRefresh ( row )
local rowGroup = row.view
local function postfade()
– remove current display obj of row
rowGroup.displayItem:removeSelf()
rowGroup.displayItem = nil
– build it again
local displayItem = buildOneRowItem(row)
rowGroup:insert( displayItem )
rowGroup.displayItem = displayItem
funx.fadeIn(row.view)
end
funx.fadeOut(row.view, postfade)
end
– handles individual row rendering
local function onRowRender( event )
local row = event.row
local rowGroup = event.view
local displayItem = buildOneRowItem(row)
row.onRowRefresh = onRowRefresh
rowGroup:insert( displayItem )
rowGroup.displayItem = displayItem
end
[/code] [import]uid: 37366 topic_id: 24277 reply_id: 129676[/import]
If i add an image object to a table row, its alpha will not work if a maskFile is set on the tableview. With text objects the alpha works as expected. Is this a bug? [import]uid: 105238 topic_id: 24277 reply_id: 129986[/import]
If i add an image object to a table row, its alpha will not work if a maskFile is set on the tableview. With text objects the alpha works as expected. Is this a bug? [import]uid: 105238 topic_id: 24277 reply_id: 129986[/import]
If you are setting a row color or background color with a transparency, then images tend to not want to be inserted into rows.
[import]uid: 19626 topic_id: 24277 reply_id: 130001[/import]
I think that’s not the problem in my case. Here is a simplified example, there is nothing special with transparency except for the row label and icon, but the problem is still the same:
[code]
local widget = require(“widget”);
local listRecs = {};
local tableView = widget.newTableView {
top = display.screenOriginY,
left = display.screenOriginX,
width = display.contentWidth - display.screenOriginX * 2,
height = display.contentHeight - display.screenOriginY * 2,
bgColor = {0},
maskFile = “mask.png”, – if i remove this, then icon.alpha works fine
}
tableView.content.horizontalScrollDisabled = true;
for i = 1, 20 do
local title = "Item "…i;
listRecs[i] = {
title = title;
idx = i;
}
end
local function onRowRender(event)
local row = event.row;
local rowGroup = event.view;
local idx = row.index or 0;
local icon = display.newImageRect(“icon.png”, 30, 30);
icon.x = 20;
icon.y = row.height / 2;
icon.alpha = 0.5; – this works not
rowGroup:insert(icon);
local label = display.newText(listRecs[idx].title, 0, 0, 280, 0, native.systemFont, 14);
label:setTextColor(255);
label:setReferencePoint(display.CenterLeftReferencePoint);
label.x = 40;
label.y = row.height / 2;
label.alpha = 0.5; – this works
rowGroup:insert(label);
end
local function rowListener( event )
local row = event.row;
local idx = row.index or 1;
local background = event.background;
local phase = event.phase;
if phase == “press” then
background:setFillColor(0);
row.reRender = true;
end
end
for x = 1, #listRecs do
local rowColor;
tableView:insertRow {
onRender = onRowRender,
listener = rowListener,
height=50,
isCategory= false,
rowColor={100},
lineColor={80}
}
end
[/code] [import]uid: 105238 topic_id: 24277 reply_id: 130010[/import]
If you are setting a row color or background color with a transparency, then images tend to not want to be inserted into rows.
[import]uid: 19626 topic_id: 24277 reply_id: 130001[/import]
Yes alpha with masks is a bug. Has been around for several months. It affects more than just tables unfortuantely. I have no idea when they will look at fixing it. I hope it’s sooner rather than later. [import]uid: 56820 topic_id: 24277 reply_id: 130020[/import]
I think that’s not the problem in my case. Here is a simplified example, there is nothing special with transparency except for the row label and icon, but the problem is still the same:
[code]
local widget = require(“widget”);
local listRecs = {};
local tableView = widget.newTableView {
top = display.screenOriginY,
left = display.screenOriginX,
width = display.contentWidth - display.screenOriginX * 2,
height = display.contentHeight - display.screenOriginY * 2,
bgColor = {0},
maskFile = “mask.png”, – if i remove this, then icon.alpha works fine
}
tableView.content.horizontalScrollDisabled = true;
for i = 1, 20 do
local title = "Item "…i;
listRecs[i] = {
title = title;
idx = i;
}
end
local function onRowRender(event)
local row = event.row;
local rowGroup = event.view;
local idx = row.index or 0;
local icon = display.newImageRect(“icon.png”, 30, 30);
icon.x = 20;
icon.y = row.height / 2;
icon.alpha = 0.5; – this works not
rowGroup:insert(icon);
local label = display.newText(listRecs[idx].title, 0, 0, 280, 0, native.systemFont, 14);
label:setTextColor(255);
label:setReferencePoint(display.CenterLeftReferencePoint);
label.x = 40;
label.y = row.height / 2;
label.alpha = 0.5; – this works
rowGroup:insert(label);
end
local function rowListener( event )
local row = event.row;
local idx = row.index or 1;
local background = event.background;
local phase = event.phase;
if phase == “press” then
background:setFillColor(0);
row.reRender = true;
end
end
for x = 1, #listRecs do
local rowColor;
tableView:insertRow {
onRender = onRowRender,
listener = rowListener,
height=50,
isCategory= false,
rowColor={100},
lineColor={80}
}
end
[/code] [import]uid: 105238 topic_id: 24277 reply_id: 130010[/import]