Update page include from table row action?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
Is there a way to update a page include from a table row action?

I really want to use a table, not a queue.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
There are no declarative mechanisms to pass the query string into a page include and refresh the include.  What we would reccomend would be to put your detail content on the same page with your table.  The models for your detail should not load any data on page load, and should have filterable conditions to narrow down to the same single record from your table row.  

Then in your table row - the row action should activate the conditions in the detail models and requery those models.  This will show the detail associated with the row in the table. 

Hope this works.. 
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Thanks, Rob. I've done what you were describing before... I was just hoping not to have to recreate the detail pages.

Off to copy and paste some XML! :)
Photo of Joe Ort

Joe Ort

  • 2,256 Points 2k badge 2x thumb
It sounds like you're attempting something similar to the Case Management page on the repo.
https://github.com/skuidify/SamplePages/blob/master/pages/Case%20Management%20Page
I'm about to try a similar concept and I'll see if I can't update the javascript that does the "View Case" work.




var detailModel = skuid.model.getModel('CaseDetail'); var detailCommentsModel = skuid.model.getModel('CaseDetailComments'); var detailTasksModel = skuid.model.getModel('CaseDetailTasks'); var detailCondition = detailModel.getConditionByName('CaseId'); var detailCommentsCondition = detailCommentsModel.getConditionByName('CaseId'); var detailTasksCondition = detailTasksModel.getConditionByName('CaseId'); detailModel.setCondition(detailCondition,args.item.row.Id,true); detailCommentsModel.setCondition(detailCommentsCondition,args.item.row.Id,true); detailTasksModel.setCondition(detailTasksCondition,args.item.row.Id,true); skuid.model.updateData([detailModel,detailCommentsModel,detailTasksModel]);
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
That case management page was built before we had the action framework. The javascript in that page is now really not necessary when you chain together a number of actions. 
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
For the record I managed to get at some Javascript methods that can be used for this. I have a page include that I need to update with different pages and query strings depending on what search result is clicked on. "include" is the unique id of the page include.

var params = arguments[0],	$ = skuid.$;
var row = params.row; //get the page include JS object
var pageInclude = $('#include').data('object');
var pageName, queryStr;
switch(row.attributes.type){
    case "Utility_Account__c":
        pageName = 'UtilityAccountDetail_Widgets';
        queryStr = 'id=' + row.Id;
        break;
    case "Account":
        pageName = 'AccountFinanceTeam';
        queryStr = 'id=' + row.Id;
        break;
    case "Lead":
        pageName = 'LeadDetail';
        queryStr = 'id=' + row.Id;
        break;
    case "Contact":
        pageName = 'UtilityAccountDetail_Widgets';
        queryStr = 'id=' + row.Id;
        break;
} //set the page to load
pageInclude.pagename = pageName; //set the querystring params
pageInclude.querystring = queryStr; //load the page
pageInclude.load();

 
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,738 Points 5k badge 2x thumb
That's pretty cool, Moshe. I've spent the Christmas break playing around with single page app concepts and page includes in Skuid and this might come in rather handy. Thanks for sharing.