Skip to content

Commit

Permalink
Update "number of rows" when setting dvData (#1)
Browse files Browse the repository at this point in the history
When setting the `dvData` property of the DataView the `RenderView` handler will be called. This handler relies on the `viewProp["number of rows"]` property which must accurately reflect the number of rows. By intercepting the `setProp` and adjusting the number of rows to the number of elements in the array `RenderView` works correctly.
  • Loading branch information
trevordevore authored Sep 20, 2021
1 parent a12fead commit 1f21570
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions dataview_paginated_scroll.livecodescript
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,21 @@ getProp dvLastRowOfPage[pPage]
end dvLastRowOfPage


/**
Summary: Update the "rows per page" and then pass to parent behavior.
Returns: nothing
*/
setProp dvData pDataA
local tRowCount

put the number of elements of pDataA into tRowCount
put tRowCount into sLocalsA["number of rows"]

pass dvData
end dvData


/**
Summary: Adds data to a page in the DataView's data source.
Expand Down Expand Up @@ -216,6 +231,10 @@ Returns: nothing
private command _AddCurrentPageOfDataToQueue pRowWithMissingId
local tPageToLoad, tItemNo

if sLocalsA["rows per page"] < 1 then
return empty
end if

set the wholematches to true

put (pRowWithMissingId + (sLocalsA["rows per page"]-1)) \
Expand Down

0 comments on commit 1f21570

Please sign in to comment.