Jquery plug-in is designed to hide some rows on the SageCRM query screen.

Source: Internet
Author: User
SageCRM has many query conditions on the screen, which occupies the interface. The user wants to display common query conditions first, and then click the expand button to see some of the solutions to the uncommon query conditions:
1. Add a [-] [+] to the title for users to click.
2. the user's behavior of shrinking and expanding the screen is saved in the Cookie. You can still remember your behavior when you reload the page or log on to the system again.
  
Advantages: 1. It is easy to expand using Jquery plug-ins. Easy to implement.
2. The behavior stored in the Cookie is easy to implement, reduces the workload, and users can also receive it. If a database is saved, the page load is increased.
Disadvantage: individual behaviors cannot be used on each page. It means that every user's contraction and expansion are global in the system. After logging on to another computer or clearing the cache, you cannot remember your operations.
  
First, use js functions. Then change to the Jquery plug-in: Code

The Code is as follows:


/*
* TableToggle 0.1
* Copyright (c) 2011 Novus_lee http://www.cnblogs.com/novus
* Date: 2011-12-23
* Hide some rows on the SageCRM query Screen
*/
(Function ($ ){
$. Fn. TableToggle = function (options ){
Var defaults = {
Plussrc: "/upload/201112/20111226224658296 .gif", // -- [+] Image
Minussrc: "/upload/201112/20111226224658809 .gif ",
Line: 2
}
Var options = $. extend (defaults, options );
Var flip = 0, I = 0;
This. each (function (){
Var $ thisTable = $ (this );
Var claName = "btntoggle" + I;
// -- Add an image button above the table
Var $ Title = $ thisTable. parent (). find ("td. PANEREPEAT ");
$ Title. prepend ("");
Var trlen = $ thisTable. find ("tr"). length;
Options. line = (options. line> trlen? Trlen: options. line );
$ Title. find ("a." + claName). click (function (){
$ ThisTable. find ("tr: gt (" + options. line + ")"). toggle (flip ++ );
If (flip % 2 = 0)
{
$ Title. find ("img [src * = 'smallplus ']"). attr ("src", options. minussrc );
$. Cookie (claName, "plus ");
}
Else
{
$ Title. find ("img [src * = 'smallminus']"). attr ("src", options. plussrc );
$. Cookie (claName, "smallminus ");
}
});
If ($. cookie (claName) = "smallminus" | $. cookie (claName) = "" | $. cookie (claName) = null)
{
$ ("A." + claName). click ();
}
I ++;
});
};
}) (JQuery );


The plug-in also calls a jquery Cookie plug-in.
Call method:

The Code is as follows:


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.