Is it possible to make child conditions "Filterable Default Off" and then use an action to "Active and Set Model Condition"

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
Is it possible to make child conditions "Filterable Default Off" and then use an action to "Active and Set Model Condition"
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb

Posted 2 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Child conditions on child relationships?
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Yep. (I think). I want to use a child template in a table, but I need to put conditions on the children that appear. The conditions on children fields in a model are "Always on". I'm wondering if I can hack xml to allow them to be set dynamically by a button then requery the whole model.
Also, I tried setting the condition to "in another model", but it doesn't seem to work. If I could get that working, I could accomplish what I am looking for by putting conditions on that other model.
Thanks!
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Hmmm .... I'm sure it's possible one way or the other.
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
This works for now in javascript but be warned of Skuid's explicit lack of support for it.
NOTE
All properties in the Condition Metadata Object should be treated as read-only. Overwriting these values on the rendered page will result in undefined behavior and likely cause unexpected and undesirable results.

skuid.model.getModel('modelName').fieldsMap.Child_Relationship__r.subConditions[subConditionIndex].inactive = true; // sets the sub condition to inactive
skuid.model.getModel('modelName').fieldsMap.Child_Relationship__r.subConditions[subConditionIndex].inactive = active; // sets the sub condition to active

You can do the same thing with setting the condition's value

skuid.model.getModel('modelName').fieldsMap.Child_Relationship__r.subConditions[subConditionIndex].value = singleValue; // sets the sub condition value if it's a single value condition
skuid.model.getModel('modelName').fieldsMap.Child_Relationship__r.subConditions[subConditionIndex].values = valueArray; // sets the sub condition value if it's a multi-value condition
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Yup. You did the digging I didn't want to. ;)
Photo of Shmuel Kamensky

Shmuel Kamensky, Champion

  • 4,328 Points 4k badge 2x thumb
Ha I did the digging a while back. Just sharing the dirt now.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Love your dirt!
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,220 Points 5k badge 2x thumb
Thanks for digging and sharing the dirt :)