有时候在自定义的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. K8S集群集成harbor(1.9.3)服务并配置HTTPS

    一.简介 简介请参考:https://www.cnblogs.com/panwenbin-logs/p/10218099.html 二.安装Harbor主机环境及安装要求 主机环境: OS: Cent ...

  2. Vert.x HTTP 服务器与客户端

    编写HTTP 服务器与客户端 Vert.x让编写非阻塞的HTTP 服务器与客户端变得非常轻松. 创建HTTP 服务器 缺省状况: HttpServer server = vertx.createHtt ...

  3. python3字符串常用操作练习

    练习一下字符串的常用操作 #-*- coding:utf-8 -*- #字符串的常用操作 str = "1111 Hell :wo:rld! " #删除头尾所有指定字符串,默认移除 ...

  4. QT 使用QSetting读取配置文件中的中文乱码解决方案

    windows下方案: 首先需要将ini文件改成UTF-8或GB2312编码格式,可以通过notepad++工具实现.然后在配置项中填入中文,如下: 接着在程序中使用 QSettings settin ...

  5. 解决Ubuntu在虚拟机窗口不能自适应

    试了很多办法这个好用 相信很多人在装虚拟机的时候,遇到了窗口过小不能自适应的问题.我也是查了好多资料,都说安装Vmware Tools即可解决,还有说修改分辨率也可以.两种方法亲测无效. Vmware ...

  6. Mybatis使用Mybatis-generator插件及配置(数据库逆向工程)

    Mybatis使用Mybatis-generator插件 首先在POM.xml文件添加架包,我这里用的是SpringBoot,所以用的也是SpringBoot架包,最少要mybatis,generat ...

  7. 奇怪的ifcfg-eth0被自动还原

    最近,一台虚拟机是从外网下载的,然后导入本地测试环境使用. 发现一个奇怪的问题:修改了 /etc/sysconfig/network-scripts/ifcfg-eth0 保存后, 重启网络服务( s ...

  8. windows下git安装过程

    参考廖雪峰博客: https://www.liaoxuefeng.com/wiki/896043488029600/896067074338496 git网站下载程序:   https://git-s ...

  9. Python环境安装与基础语法(1)——计算机基础知识

    Python安装 pip #包管理工具 pip install #安装包 pip list #查看包 IPython #增强的python shell,自动补全,自动缩进,支持shell,增加了很多函 ...

  10. 7. Transformer-XL原理介绍

    1. 语言模型 2. Attention Is All You Need(Transformer)算法原理解析 3. ELMo算法原理解析 4. OpenAI GPT算法原理解析 5. BERT算法原 ...