有时候在自定义的visualforce页面上,需要实现系统标准的查找样式,当不能使用标准的style的时候,我们只能选择自定义实现,下面分享一个demo,预览效果如下:

实现代码,Visualforce页面

 <!-- 自定义放大镜查找效果 -->
 <apex:page showHeader="false" controller="SelectSystem"  standardStylesheets="false"  sidebar="false" title="产品清单">
 <html>
 <head>
     <link rel="stylesheet" href="{!URLFOR($Resource.StaticResource,'css/animate.css')}"/>
     <link rel="stylesheet" href="{!URLFOR($Resource.StaticResource,'css/bootstrap.min.css')}"/>
     <link rel="stylesheet" href="{!URLFOR($Resource.StaticResource,'css/style.css')}"/>
 </head>
 <apex:form id="form_Id">
 <apex:actionFunction action="{!getProductWithId}" name="getProductWithId" reRender="form_Id">
    <apex:param name="myParam" value=""/>
 </apex:actionFunction>
 <body>
     <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="10">
         <thead>
             <tr>
               <th data-hide="phone">产品</th>
               <th data-hide="phone">描述</th>
               <th data-hide="phone">型号</th>
               <th data-hide="phone">品牌</th>
               <th data-hide="phone">单位</th>
             </tr>
         </thead>
         <tbody>
             <apex:repeat value="{!CustomAddProduct}" var="p" >
               <tr>
                 <td>
                     <apex:inputField id="pro" value="{!p.getProduct__c}" styleClass="lookupInput"  onchange="f3(this);"/>
                 </td>
                 <td>{!p.Description__c}</td>
                 <td>{!p.Model__c}</td>
                 <td>{!p.Brand__c}</td>
                 <td>{!p.Unit__c}</td>
               </tr>
             </apex:repeat>
         </tbody>
     </table>
 </body>
 <script type="text/javascript">
      function f3(obj){
         var objVa = document.getElementById(obj.id+'_lkid').value;
         console.log('get到的产品id是:' + objVa);
         getProductWithId(objVa);
     }
 </script>
 <style type="text/css">
     .lookupInput
     {
         display: inline;
         vertical-align: middle;
         white-space: nowrap;
     }
     .lookupInput img
     {
         background-repeat: no-repeat;
         margin-right: .25em;
         vertical-align: middle;
     }
     .lookupInput .disabled{
         background-color: #ccc;
     }
     .lookupInput .emptyDependentLookup{
         font-style: italic;
     }
     .lookupInput input[readonly]{
         background-color: #e6e6e6;
         border: 2px solid #e6e6e6;
         color: #333;
         cursor: default;
     }
     .lookupInput a.readOnly{
         float: right;
     }
     .lookupInput span.readOnly
     {
         display: block;
         white-space: normal;
     }
     .lookupInput span.totalSummary{
         font-weight: bold;
     }
     .inlineEditRequiredDiv .lookupInput img,.inlineEditDiv .lookupInput img{
         vertical-align: middle;
     }
     .quickCreateModule .lookupInput input {
         max-width: 155px
     }
     .lookupIcon
     {
         background-image: url({!URLFOR($Resource.lookup,'lookup20.gif')});
         background-position: 0 0;
         width: 20px;
         height: 20px;
         background-position: top left
     }
     .lookupIconOn
     {
         background-image: url({!URLFOR($Resource.lookup,'lookup20.gif')});
         background-position: 0 0;
         width: 20px;
         height: 20px;
         background-position: top right
     }
 </style>
 </apex:form>
 </html>
 </apex:page>

后台控制类

 /********
     *
     *  @Author:Ricardo
     *  @Time: 2018-01-26
     *  @Function: 自定义放大镜
     *
     */
 public class SelectSystem{
     public Product__c CustomAddProduct{get;set;}//自定义添加产品

     public void GetProductWithId(){
         string ProductIdParam = Apexpages.currentPage().getParameters().get('myParam');
         System.debug('输出get到的产品id:' + ProductIdParam);
         if((ProductIdParam) != null || (ProductIdParam != '')){
             String sql_new = 'select getProduct__c,Unit__c,Description__c,Brand__c,Model__c,id,Name from Product__c where  id=\'' + ProductIdParam + '\' limit 1';
             System.debug('输出查询语句:' + sql_new);
             CustomAddProduct = Database.Query(sql_new);
             CustomAddProduct.getProduct__c = ProductIdParam;
             System.debug('查询结果:' + CustomAddProduct);
         }
     }
 }

附赠使用的css文件

链接: https://pan.baidu.com/s/1FbR8vSD6iER4ShbuYi_7qQ 密码: 29a3

Salesforce 开发整理(十一) 自定义放大镜查找效果的更多相关文章

  1. Salesforce 开发整理(八)PDF打印相关

    一:基础设置 Salesforce中的PDF页面本质上还是Visualforce[简称VF]页面,所以只需要给VF页面加上一个属性[renderAs="pdf"] 即可生成一个PD ...

  2. Salesforce 开发整理(五)代码开发最佳实践

    在Salesforce项目实施过程中,对项目代码的维护可以说占据极大的精力,无论是因为项目的迭代,还是需求的变更,甚至是项目组成员的变动,都不可避免的需要维护之前的老代码,而事实上,几乎没有任何一个项 ...

  3. Salesforce 开发整理(九) 开发中使用的一些小技巧汇总[持续更新]

    1.查询一个对象下所有字段 当需要查询一个对象所有字段进行复制或其他操作,可以使用一段拼接的语句来查询 String query = 'select '; for(String fieldApi : ...

  4. Salesforce 开发整理(二)报表开发学习

    Salesforce提供了强大的报表功能,支持表格.摘要.矩阵以及结合共四种形式,本文探讨在站在开发的角度要如何理解报表. 一:查询报表基本信息报表在Sales force中是Report对象,基本的 ...

  5. Salesforce 开发整理(一)测试类最佳实践

    在Sales force开发中完善测试类是开发者必经的一个环节,代码的部署需要保证至少75%的覆盖率,那么该如何写好测试类呢. 测试类定义格式如下: @isTest private class MyT ...

  6. Salesforce 开发整理(十)项目部署总结

    项目部署顺序 全局值集 小组 自定义字段-对象-设置(SF1 紧凑布局要和记录类型在这里要一起部署) 邮件模板-静态资源 角色 工作流-流定义(包含进程生成器) 批准过程 开发部署<Apex类, ...

  7. Salesforce 开发整理(七)配置审批流

    salesforce提供了比较强大的可配置审批流功能,在系统中翻译为“批准过程”.所以需要配置审批时,选择创建 ——>  工作流和批准 ——> 批准过程,然后选择管理批准过程,选择需要配置 ...

  8. Salesforce 开发整理(六) Visualforce分页

    分页的实现总体上分真分页和假分页. 所谓真分页指页面上列出来的数据就是实际查询的数据,假分页则是无论页面上一次显示多少条记录,实际上后台已经加载了所有的记录,分页只是为了展示给用户查看.今天分享一个V ...

  9. Salesforce 开发整理(四)记录锁定

    如果一个对象的记录在满足某个条件的情况下,希望能对其进行锁定,即普通用户没有权限对其进行编辑操作,记录页面显示如下图 一般会在提交审批,或者项目进行到某个阶段的情况下,由后台进行判断要不要锁定记录,或 ...

随机推荐

  1. Kubernetes Pod 资源限制

    Kubernetes Pod 资源限制 官方文档:https://kubernetes.io/docs/concepts/configuration/manage-compute-resources- ...

  2. ELK 日志平台 For Windows

    一.Logstash 安装 1. 下载最新版本的logstash:  https://www.elastic.co/fr/downloads/logstash 下载zip格式的压缩包. 然后解压缩放到 ...

  3. 【微信原生支付】服务商模式-小微商户专属接口:小微商户新增对应APPID关联API

    文档地址:https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=20_3&index=3 这个接口比较特殊不需要nonce_st ...

  4. C# winform打开新窗体显示一段时间 关闭新窗体

    1.form1的button事件下: form2 form = new form2(); form.Show(); Thread.Sleep(10000);  //form2窗体显示10秒 form. ...

  5. Asp.Net MVC 的19个管道事件

    httpApplication调用ProcessRequest方法,内部执行19个管道事件,如下 BeginRequest  开始处理请求 AuthenticateRequest 授权验证请求开始,获 ...

  6. Java中级知识归纳(四)

    十六.Java内存模型 特点:原子性.可见性.有序性. 原子性:read.load.use.store.write.synchronized关键字保证原子性 可见性:synchronized.vola ...

  7. java基本程序设计结构总结

    学习一门语言:(1)掌握它的表现形式(2)这些语言什么应用. 1.1关键字 1.关键字是被赋予了特殊含义的单词. 2.关键字特点:关键字所有字母都小写. 3.类名的每一个单词开头必须大写. 1.2标识 ...

  8. windows zlib库编译步骤

    下载地址 http://www.zlib.net/ 动态库下载地址 如果自己实在不想编译的,可以直接下载 https://download.csdn.net/download/zhangxuechao ...

  9. GCN 简单numpy实现

    `#参考:https://blog.csdn.net/weixin_42052081/article/details/89108966 import numpy as np import networ ...

  10. 【转载】CMake 两种变量原理

    原文地址:https://cslam.cn/archives/c9f565b5.html 摘要: 本文记录一下 CMake 变量的定义.原理及其使用.CMake 变量包含 Normal Variabl ...