Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions widgetLibrary/widget_tableview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,9 @@ local function createTableView( tableView, options )
if not self._targetRow.isCategory then
if self._targetRow._wasTouched then
-- Set the row cell's fill color
self._targetRow._cell:setFillColor( unpack( self._targetRow._rowColor.default ) )
if type(self._targetRow._cell.setFillColor)=='function' then
self._targetRow._cell:setFillColor( unpack( self._targetRow._rowColor.default ) )
end
-- Set back the separators
if self._targetRow._separator then
self._targetRow._separator.isVisible = true
Expand Down Expand Up @@ -762,7 +764,6 @@ local function createTableView( tableView, options )
function view:_renderCategory( row, reloadDataInvocation )
-- Create a reference to the row
local currentRow = row

-- Function to create a new category
local function newCategory()
local category = display.newGroup()
Expand Down Expand Up @@ -934,24 +935,27 @@ local function createTableView( tableView, options )
end
end

-- Determine which category should be rendered (Sticky category at top)
if currentRow.isCategory and currentRow._top <= 0 then
self._currentCategoryIndex = k
end
-- Determine which category should be rendered (Sticky category at top)
local lRowTopY=self.y + currentRow.y + self._height * 0.5-0.5*currentRow._height
if currentRow.isCategory and lRowTopY <= 0 then
self._currentCategoryIndex = k

-- Hide the current row
-- Hide the current row
if(type( currentRow._view ) == "table") then
currentRow._view.isVisible = false

elseif currentRow.isCategory and currentRow._top >= 0 and self._currentCategory and currentRow.index == self._currentCategory.index then
-- Category moved below top of tableView, render previous category
currentRow._view.isVisible = true

-- Remove current category if the first category moved below the top of the tableView
display.remove( self._currentCategory )
self._currentCategory = nil
self._currentCategoryIndex = nil
elseif currentRow.isCategory and currentRow._top >= 0 then
end
elseif currentRow.isCategory and lRowTopY >= 0 and self._currentCategory and currentRow.index == self._currentCategory.index then
-- Category moved below top of tableView, render previous category
if(type( currentRow._view ) == "table") then
currentRow._view.isVisible = true
end
-- Remove current category if the first category moved below the top of the tableView
display.remove( self._currentCategory )
self._currentCategory = nil
self._currentCategoryIndex = nil
elseif currentRow.isCategory and lRowTopY >= 0 and type( currentRow._view ) == "table" then
currentRow._view.isVisible = true
end
end

Expand Down