Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. public class CFS_ContractEditItemsController {
  2.  
  3. private final Contract parent;
  4. public Contract_Item__c[] detail { get; set; }
  5.  
  6. public Contract_Item__c newItem {get; set;}
  7.  
  8. public string getProductGroupsJson() {
  9. Product_Group__c[] groups = [select Product_Line__c,Name, Product_Category__c from Product_Group__c];
  10.  
  11. return Json.serialize(groups);
  12.  
  13. }
  14. }
  15.  
  16. <apex:page standardController="Contract" extensions="CFS_ContractEditItemsController" id="page">
  17. <apex:includeScript value="//code.jquery.com/jquery-1.11.2.min.js"/>
  18.  
  19. <apex:stylesheet value="/sCSS/25.0/sprites/1342034628000/Theme3/default/gc/versioning.css"/>
  20. <apex:stylesheet value="/sCSS/25.0/sprites/1342034628000/Theme3/default/gc/extended.css"/>
  21. <apex:includeScript value="/soap/ajax/20.0/connection.js"/>
  22.  
  23. <style>
  24.  
  25. (function($) {
  26.  
  27. function setupTable() {
  28. $('.Product_Line__c tr.datarow').each(function() {
  29. var tr = $(this);
  30.  
  31. var cat = $(this).find('.Product_Line__c').val()
  32. tr.find('select.Product_Line__c').change(function() {
  33. // dependent product options
  34. populateProductPicklist(tr, getProductOptions($(this).val()));
  35. });
  36. tr.find('input, select, textarea').change(function() {
  37. saveRowData(tr, $(this));
  38. });
  39. populateCategoryPicklist(tr);
  40. // load the initial product options
  41. populateProductPicklist($(this), getProductOptions(cat))
  42. });
  43.  
  44. }
  45. function getProductOptions(cat) {
  46. return productList
  47. .filter(function(prod) { return prod.Product_Line__c == cat })
  48. .map(function(v) {
  49. return "<option>" + (v.Product_Category__c)+ "</option>";
  50.  
  51. })
  52. }
  53.  
  54.  
  55. <apex:form title="Edit Contract Items" id="form">
  56. <apex:sectionHeader title="Contract Items"/>
  57. <apex:pageMessages id="messages"></apex:pageMessages>
  58. <apex:pageblock >
  59. <form id="frmAddRow">
  60. <apex:pageBlockSection title="Product Details" collapsible="false" columns="1">
  61. <apex:inputField value="{!newItem.Product_Line__c}" styleClass="Product_Line__c" required="true"/>
  62.  
  63. <apex:pageBlockSectionItem dataStyleClass="requiredInput">
  64. <apex:outputLabel value="Product Category"></apex:outputLabel>
  65.  
  66. <apex:selectList value="{!newItem.Product_Category__c}" styleClass="Product_Category__c" required="true"/>
  67. </apex:pageBlockSectionItem>
  68. /apex:pageblock>
  69. </apex:form>
  70. </apex:page>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement