Skip to content

Commit

Permalink
Merge pull request #596 from witheve/fix-570
Browse files Browse the repository at this point in the history
fix dom ordering when sort is 0
  • Loading branch information
cmontella authored Nov 22, 2016
2 parents be114c9 + 86deb3d commit 33262d4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ export function renderRecords() {
}
elem.entity = entityId;
activeElements[entityId] = elem;
elem.sort = entity.sort || entity["eve-auto-index"] || "";
if(entity.sort && entity.sort.length > 1) console.error("Unable to set 'sort' multiple times on entity", entity, entity.sort);
if(entity.sort !== undefined && entity.sort[0] !== undefined) {
elem.sort = entity.sort[0];
} else if(entity["eve-auto-index"] !== undefined && entity["eve-auto-index"][0] !== undefined) {
elem.sort = entity["eve-auto-index"][0];
} else {
elem.sort = "";
}
if(parent) insertSorted(parent, elem)


Expand All @@ -140,7 +147,13 @@ export function renderRecords() {
elem.entity = entityId;
activeElements[entityId] = elem;
if(entity.sort && entity.sort.length > 1) console.error("Unable to set 'sort' multiple times on entity", entity, entity.sort);
elem.sort = (entity.sort && entity.sort[0]) || (entity["eve-auto-index"] && entity["eve-auto-index"][0]) || "";
if(entity.sort !== undefined && entity.sort[0] !== undefined) {
elem.sort = entity.sort[0];
} else if(entity["eve-auto-index"] !== undefined && entity["eve-auto-index"][0] !== undefined) {
elem.sort = entity["eve-auto-index"][0];
} else {
elem.sort = "";
}
let parent = activeElements[activeChildren[entityId] || "root"];
if(parent) insertSorted(parent, elem);
}
Expand Down Expand Up @@ -527,3 +540,4 @@ function injectProgram(node, elem) {
export function renderEve() {
renderer.render([{c: "application-container", postRender: injectProgram}]);
}

0 comments on commit 33262d4

Please sign in to comment.