Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CFS_ContractEditItemsController {
- private final Contract parent;
- public Contract_Item__c[] detail { get; set; }
- public Contract_Item__c newItem {get; set;}
- public string getProductGroupsJson() {
- Product_Group__c[] groups = [select Product_Line__c,Name, Product_Category__c from Product_Group__c];
- return Json.serialize(groups);
- }
- }
- <apex:page standardController="Contract" extensions="CFS_ContractEditItemsController" id="page">
- <apex:includeScript value="//code.jquery.com/jquery-1.11.2.min.js"/>
- <apex:stylesheet value="/sCSS/25.0/sprites/1342034628000/Theme3/default/gc/versioning.css"/>
- <apex:stylesheet value="/sCSS/25.0/sprites/1342034628000/Theme3/default/gc/extended.css"/>
- <apex:includeScript value="/soap/ajax/20.0/connection.js"/>
- <style>
- (function($) {
- function setupTable() {
- $('.Product_Line__c tr.datarow').each(function() {
- var tr = $(this);
- var cat = $(this).find('.Product_Line__c').val()
- tr.find('select.Product_Line__c').change(function() {
- // dependent product options
- populateProductPicklist(tr, getProductOptions($(this).val()));
- });
- tr.find('input, select, textarea').change(function() {
- saveRowData(tr, $(this));
- });
- populateCategoryPicklist(tr);
- // load the initial product options
- populateProductPicklist($(this), getProductOptions(cat))
- });
- }
- function getProductOptions(cat) {
- return productList
- .filter(function(prod) { return prod.Product_Line__c == cat })
- .map(function(v) {
- return "<option>" + (v.Product_Category__c)+ "</option>";
- })
- }
- <apex:form title="Edit Contract Items" id="form">
- <apex:sectionHeader title="Contract Items"/>
- <apex:pageMessages id="messages"></apex:pageMessages>
- <apex:pageblock >
- <form id="frmAddRow">
- <apex:pageBlockSection title="Product Details" collapsible="false" columns="1">
- <apex:inputField value="{!newItem.Product_Line__c}" styleClass="Product_Line__c" required="true"/>
- <apex:pageBlockSectionItem dataStyleClass="requiredInput">
- <apex:outputLabel value="Product Category"></apex:outputLabel>
- <apex:selectList value="{!newItem.Product_Category__c}" styleClass="Product_Category__c" required="true"/>
- </apex:pageBlockSectionItem>
- /apex:pageblock>
- </apex:form>
- </apex:page>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement