locked
Issue on Add Custom View To Subgrid RRS feed

  • Question

  • I have a custom button for "add existing records" as mentioned in below screen shot.

    The column header for the checkbox column is  getting expand for which allignment of  records and  column header is not proper  .

    Please take  a look at  the scren shot and suggest the  solution for the same.

    function addExistingFromSubGridCustom(params) {
        
        var relName = params.gridControl.getParameter("relName"),
        roleOrd = params.gridControl.getParameter("roleOrd"),
        // Setup  a Dummy view ID
        viewId = "{00000000-0000-0000-0000-000000000001}";
        //Passing the Parameters for Custom View.
        var customView = {
            fetchXml: params.fetchXml,
            id: viewId,
            layoutXml: params.layoutXml,
            name: params.ViewName,
            recordType: params.gridTypeCode,
            Type: 0
        };
    
        //associating the selected records from the Lookup grid.
        var lookupItems = LookupObjects(null, "multi", params.gridTypeCode, 0, null, "", null, null, null, null, null, null, viewId, [customView]);
        if (lookupItems && lookupItems.items.length > 0) {
            AssociateObjects(crmFormSubmit.crmFormSubmitObjectType.value, crmFormSubmit.crmFormSubmitId.value, params.gridTypeCode, lookupItems, IsNull(roleOrd) || roleOrd == 2, "", relName);
        }
    }

    function addExistingFromOptionSubGrid(gridTypeCode, gridControl) {
        var primaryEntity = "group";
    
        if (primaryEntity != "group") {
    
            Mscrm.GridRibbonActions.addExistingFromSubGridAssociated(gridTypeCode, gridControl); //default button click function 
            return;
        }
        //fetch to retrieve filtered data 
        var fetch = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
                                "<entity name='option'>" +                            
                                "<order descending='false' attribute='name'/>" +
                                "<filter type='and'><condition attribute='statecode' value='0' operator='eq'/>" +
                                "</filter>" +
                                "</entity>" +
                                "</fetch>";
        //columns to display in the custom view (make sure to include these in the fetch query) 
        var layout = "<grid name='resultset' object='1' jump='opttttionsid' select='1' icon='1' preview='1'>" +
                     "<row name='result' id='optiottnsid'>" +
                     "<cell name='name' width='300' />" +                 
                     "</row>" +
                     "</grid>";
    
        addExistingFromSubGridCustom(gridTypeCode, gridControl, fetch, layout, "Active lookUp");
    }

    Thanks


    P kar






    Wednesday, March 5, 2014 6:28 AM