Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rows statuses of "hidden" and "disabled" after adding all rows #370

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions Source/Core/BaseRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ extension BaseRow {
self.section?.form?.rowsByTag[t] = self
self.section?.form?.tagToValues[t] = baseValue as? AnyObject ?? NSNull()
}
}

final func updateRowInSection() {
addToRowObservers()
evaluateHidden()
evaluateDisabled()
Expand Down
13 changes: 13 additions & 0 deletions Source/Core/Section.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ extension Section : RangeReplaceableCollectionType {
kvoWrapper.rows.insertObject(formRow, atIndex: kvoWrapper.rows.count)
kvoWrapper._allRows.append(formRow)
formRow.wasAddedToFormInSection(self)
formRow.updateRowInSection()
}

public func appendContentsOf<S : SequenceType where S.Generator.Element == BaseRow>(newElements: S) {
Expand All @@ -211,6 +212,10 @@ extension Section : RangeReplaceableCollectionType {
for row in newElements{
row.wasAddedToFormInSection(self)
}

for row in newElements {
row.updateRowInSection()
}
}

public func reserveCapacity(n: Int){}
Expand All @@ -228,6 +233,10 @@ extension Section : RangeReplaceableCollectionType {
for row in newElements{
row.wasAddedToFormInSection(self)
}

for row in newElements {
row.updateRowInSection()
}
}

public func removeAll(keepCapacity keepCapacity: Bool = false) {
Expand Down Expand Up @@ -284,6 +293,10 @@ extension Section /* Condition */{
for row in kvoWrapper._allRows {
row.wasAddedToFormInSection(self)
}

for row in kvoWrapper._allRows {
row.updateRowInSection()
}
}

/**
Expand Down