Chained Tables

Is there a way to set a condition on one table so that it shows records linked to the selected record in another table on the same form I think the first problem is that there is not a way to “select” a record, other than to check its checkbox it would new a “record selector” that make the id of that row available in javascript (?) so that the other table’s condition could get access to it This is a pretty common pattern… in this case i want to display a list of statements for a client… and list of payments for the selected statement I could do it by use a row level action and going to another form… but it would be really nice to do it on the same form

Have you checked out our sample management pages on the repo? They allow you to do something like this: pick a record from a list in one part of your page, and then view its details on the right. Eventually we want to make this its own component because it’s a very useful feature. Is this the sort of thing you were thinking about?

Anna, That’s what I want to do Which page is in your illustration ? I guess I can look at it and figure out how to link the tables together I find sometimes in SKUID that until I understand where all the settings are even looking at an example doesn’t necessary tell me how to do something… thanks ken

It’s the Case Management Page. What you need is the JS resource on this page, and then you have a filterable condition on each of your Detail models that the JS reads and inserts the selected record into. What helps me is to copy and paste the example page into my org. Then I go through methodically and try to recreate it myself, model by mode, condition by condition, etc. That’s basically how I figured out how to do this, by copying this page that Ben built. With the Javascript it references your models by name, so for different objects make sure you go in and put the name of your own in there.

Thanks, I found the page, and the javascript. You’re right… this should be a component… its a very common interface requirement for database apps

True story. I’m going to make this suggestion an idea.

(I made a related Idea conversation for this conversation). Please reference the new topic here: Make a “Management” / Detail-List Component

when i tried this i get an error here’s my version of the javascript fragment… i’m only using one detail table, not three as in the example page

// create a variable that represents the model you want to filter var detailModel = skuid.model.getModel('Client_Statement_Payment_Detail'); // create a variable that represents the condition you want to invoke on the model you want to filter var detailCondition = detailModel.getCondition('Client_Statement__c'); // set the condition to the id of the current row var detailModel.setCondition(detailCondition,args.item.row.Id,true); // update the model you are filtering skuid.model.updateData([detailModel]); 

i get “unexpected token” for the “setcondition” line… and it looks like the “true” is what it is complaining about

Hi Ken, Try changing this…

var detailCondition = detailModel.getCondition('Client_Statement__c'); 

to this…

var detailCondition = detailModel.getConditionByName('Client_Statement__c'); 

Unfortunately we’re getting into parts of the skuid api that are yet undocumented. We’re hoping to add these methods to our documentation soon.

thanks ben, that gave the same error i decided that detailModel.setCondition line should not start with var… as the variable is already defined so i changed that and now i get an error that thinks that “detailModel” is undefined

var detailModel = skuid.model.getModel('Client_Statement_Payment_Detail'); var detailCondition = detailModel.getCondition('Client_Statement__c'); detailModel.setCondition(detailCondition,args.item.row.Id,true); skuid.model.updateData([detailModel]); 

the error is on the line that tries to set detailCondition the error is can’t call getModel on undefined you can see from the screen shot that i do have a model of the right name and it does have a condition with the right name

From the code you just posted, I’m still seeing that you’re using “getCondition” instead of “getConditionByName”

ben, yes, but changing that still throws the same error Uncaught TypeError: Cannot call method ‘getConditionByName’ of undefined

Ok, I think I figured it out. What Javascript Resource type are you using? Inline? or Inline (Snippet)? You should be using inline snippet. Zach wrote up a good explanation of the different javascript resource types here.

Ben, Bingo, that was it this one has bitten me before… i should have noticed now the page is working

And of course now that the Queue component has been released with the summer 2013 release. You no longer need to fool with the javascript. Yay!! Page Not Found — Skuid v15.1.6 Documentation

Unless you still want to use the table view as the main driver, right?

The capabilities and customizations listed above will all still work.  If you want to drive it all off a table its still there. 

Cool, got it working using the table and JS Snippet.