1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to filter text fields that are empty?

Discussão em 'PSDN - Forum' iniciado por sorita.d.godfrey@gmail.co, Agosto 18, 2017.

  1. I'm trying to fetch records using the rbf_getViewPage API but I can't find a way to filter empty text fields. In the documentation, it was mentioned that we can use NUL opcode in filters to text fields. The error below is displayed whenever this filter is used:

    [​IMG]

    I also tried EQ opCode where the value is an empty string but I'm getting all records instead. I'm using version 4.5.3.


    <style>/* Global Styling */#rb-tab-content-box { visibility: hidden;}.rbs-pageTitle { display: none;}.rbs-sectionContent-noBorder-noToolbar { margin: 0px !important;}.right { float: right;}
    /* User Panel */#panel-wrapper { display: none;}#main { font-size: 1.0em; margin: 0 auto; display: block; border: 1px solid #e1e1e1; border-top: solid 3px #00c0ef; margin: 0 1% 20px; margin: 0 15px 20px; box-shadow: 0 0px 24px 0 rgba(0, 0, 0, 0.06), 0 1px 0px 0 rgba(0, 0, 0, 0.02);}#main-list { padding-top: 10px;}#main-list h2 { display: inline-block; font-size: 1.6em; vertical-align: middle; padding: 0; margin: 0; max-width: 90%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}#main-list h3 { margin: 3px; font-size: 1.2em; font-size: 1em; padding: 0px 0 10px;}#main-list .k-link.k-header { padding-bottom: 20px !important; border-bottom: 1px solid #F0F0F0 !important;}#main-list #panel .k-link.k-header { padding-bottom:0 !important; border:0 !important; }#current-img { width: 40px; height: 40px;}.k-panelbar > .k-item > .k-link { margin-bottom: 0px; }.k-state-active { height: auto !important;}.panel .k-link span { font-size: 1.1em;}.panel .k-link .k-icon { padding-top: 10px;}.panel .k-link { padding: 2px 20px !important;}.panel .k-content { padding: 0 2%;}.panel .k-icon { position: relative;}.panel img { margin: 5px 15px 5px 5px; border: 1px solid #ccc; border-radius: 50%; height: 25px; width: 25px;}.panel .big { margin-top: 0px !important;}#main-list #panel .teamLi .teamElem { border-bottom: 2px solid #357EC7 !important; padding-top:10px !important; padding-bottom:5px !important;}.teamTitle { font-weight: bold;}.teamElem:hover,.teamTitle:hover,.person:hover,.team:hover { cursor: pointer; cursor: hand;}.teamTitle:hover, .teamElem:hover { background-color: #CFF;}.person, .team { border-bottom: 1px dashed #ccc !important; padding-top: 5px !important;}.person:hover { background-color: #FFC;}.team:hover { background: #FC9;}.team span { font-size: 15px;}.form-group a { display: block; float: none !important; position: relative; padding-left:0; padding-right:0; white-space:normal !important;}#list-filter button { padding: 10px 0px !important; width: 47%;}#list-filter .button-container { text-align: center;} #list-filter .container-fluid { display: block !important;}#userFilter { width: 100%; margin-bottom: 10px; border: #000 1px solid; height: 40px;} /* Grid */#pipelineGrid,#grid { height: 100%;}#pipilineGrid { display: none; box-shadow: 0 0px 24px 0 rgba(0, 0, 0, 0.06), 0 1px 0px 0 rgba(0, 0, 0, 0.02);}#grid tr { border-left: 1px solid #DDD; }#grid td { overflow: visible;}#grid :link, #grid :visited { color: #337AB7; }#grid .k-grid-header .k-header { background-color: #2f4050; text-align: center; color: #FFF !important;}#grid .k-grid-header .k-header a { color: #FFF !important;}#grid .k-grouping-header { padding: 0 !important; display: none;}#grid .k-grid-content { height: 100%; overflow-y: visible; overflow-x: scroll;}#grid thead .k-i-arrow-s { background-image: url('../css/kendoui/Flat/sprite.png');}#grid thead .k-i-arrow-n { background-image: url('../css/kendoui/Flat/sprite.png');}/* Grid Control */.k-combobox .k-icon.k-i-close{ display: none !important;}.form-control { width: 100% !important;}a.btn-block-xs { font-weight:bold; color:#FFF; }#grid .menu { white-space: nowrap; }#grid .k-pager-wrap { border: 1px solid #DDD; }/* Cards */.responsive { width:100%; }.slick-track { overflow:hidden;}.slick-track .slick-slide:last-child .card-box { width: 94%;}.card-94 { width:94% }.card-anchor, .card-anchor:hover { color: #5A738E; text-decoration: none !important; }.viewIcon { margin-top: 30px;}.info-modal-body { padding-bottom: 5px;}.info-modal-body div { font-size: 16px;}.info-modal-body .row { margin-top: 5px;} .spacer { height: 12px; clear: both; width: 100%;} .infoValue { font-weight: bold;}
    /* Mobile List View */#mobile-container { display: none; overflow:visible; float:left;}#list { background-color: #f9f9f9;}div.item-wrapper { background-color: #fff; width: 100%; margin: 0px auto; padding:10px; border:0;
    box-shadow: 0px 5px 10px -8px #000;}div.details { clear:both; line-height: 1.42857143;}h3.title { color: #00c0ef; font-size: 16px; margin: 0px; margin-bottom: 3px; padding: 0px; clear: both; line-height:1.1;}h3.title i { margin-left: 5px;}h3.company_name { font-weight:bold;}span.title { color: #0376ca; font-size: 14px; float: right; line-height: 28px;}ul.no-ul { padding: 0; list-style: none; color: #6e7990;}ul.no-ul li { margin-bottom:3px;}div.followup-date { float: left;}div.status { float: right;}#mobile-container .km-list>li { padding: 8px 10px; border: 1px solid #f3f3f3; background: #FFF;}#mobile-container .km-list>li:nth-of-type(odd) { background-color: #f9f9f9;}#mobile-container .km-scroll-wrapper,#mobile-container .km-view { background-color: transparent !important;}.km-load-more .km-button { color: #888e90; background: #fff; border-color: #888e90; font-size: 1.25em;}.rbs-card-no-record { margin: 0px;}.rbs-card-no-record h2 { font-family: Lato, sans-serif;}.km-group-title { border-width: 1px !important; padding-top: 1em !important; padding-bottom: 1em !important; background: none !important; border-bottom-width: 0 !important; border-color: #f3f3f3 !important;}.km-group-title .km-text { font-size: 2em; text-align: center; font-weight: 400; color: #0376ca !important; text-transform: capitalize;}.km-content { background: none !important;}@media (max-width: 767px){ #main { margin-left: 0; margin-right: 0; } .col-sm-12, .col-xs-12 { padding-left:0 !important; padding-right:0 !important; } .card-box-cutomwidth { width: 96%; } .slick-track .slick-slide:last-child .card-box { width: 96%; } a.btn-block-xs { width:auto; float:none !important; } #main-list h2 { font-size: 1.5em; } #main-list .k-header:after { margin-top:3px; }}</style><script id="next-action" type="text/x-kendo-template"><ul class="menu k-widget k-menu"> <li class="k-item k-state-default"> <span class="k-link">Actions <span class="k-icon k-i-arrow-s"></span> </span> <ul class="k-group k-menu-group"> <li class="k-item k-state-default"><a class="k-link" target="_blank" href="../m/main.jsp?pageId={!#LINK.Pipeline_Lead#id}&id=#: id #"><i class="fa fa-eye" aria-hidden="true"></i> View Lead</a></li> <li class="k-item k-state-default"><a class="k-link" target="_blank" href="{!#LINK.Pipeline_Lead#7450891}&id=#: id #&destId={!#PAGE_ID}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit Lead</a></li> <li class="k-item k-state-default"><a class="k-link" target="_blank" href="#=addCommentUrl#&id=#: id #&relatedId=#: id #&returnId=#: id #"><i class="fa fa-comments-o" aria-hidden="true"></i> Add Comment</a></li> <li class="k-item k-state-default"><a class="k-link" target="_blank" href="#=logCallUrl#&id=#: id #&relatedId=#: id #&returnId=#: id #"><i class="fa fa-calendar-check-o" aria-hidden="true"></i> Log Call</a></li> <li class="k-item k-state-default"><a class="k-link" target="_blank" href="#=schedAppUrl#&id=#: id #&relatedId=#: id #&returnId=#: id #"><i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Schedule New Appointment</a></li> <li class="k-item k-state-default"><a class="k-link" target="_blank" href="#=logAppUrl#&id=#: id #&relatedId=#: id #&returnId=#: id #"><i class="fa fa-calendar" aria-hidden="true"></i> Log Appointment</a></li> <li class="k-item k-state-default"><a class="k-link" target="_blank" href="#=addTaskUrl#&id=#: id #&relatedId=#: id #&returnId=#: id #"><i class="fa fa-tasks" aria-hidden="true"></i> Add Task</a></li> #if(Target__Text_ == "Suspect"){# <li class="k-item k-state-default"><a class="k-link" target="_blank" href="#=convertLeadUrl#&id=#: id #&relatedId=#: id #&returnId=#: id #"><i class="fa fa-exchange" aria-hidden="true"></i> Convert To Prospect</a></li> #}# </ul> </li></ul></script><script id="tree-item" type="text/x-kendo-template">#if(CUSER != null) {# <li class="k-state-active teamLi user-item" id="item_#: id #"> <span class="teamTitle">#: firstName #'s Team</span> <div> <div class="k-content team" onclick="setSelectedUser(#: id #, true)"> <h3>View #: firstName # #: lastName #'s Entire Team</h3> </div> #if (Show_in_Pipeline_) {# <div class="k-content person" onclick="setSelectedUser(#: id #, false)"> <span><img src="#: User_Profile_Pic_URL #">#: firstName # #: lastName #</span> </div> #}# <ul class="panel" id="#: id #"></ul> </div> </li>#} else if (Show_in_Pipeline_) {# <div class="person user-item" onclick="setSelectedUser(#: id #, false) " id="item_#: id #"> <span><img src="#: User_Profile_Pic_URL #">#: firstName # #: lastName #</span> </div>#}#</script><script id="user-filter" type="text/x-kendo-template"> <li id="list-filter"> <div class="container-fluid"> <div class="row"> <div class="col-sm-10"> <input type="text" id="userFilter" class="form-control" placeholder="Search for user" onkeypress="filterChange(event)" > </div> <div class="col-sm-2 button-container"> <button class="btn btn-info btn-block-xs-2" onClick="filterUsers();">Search</button> <button class="btn btn-info btn-block-xs-2" onClick="clearFilters();">Clear Search</button> </div> </div> </div> </li></script><script type="text/x-kendo-template" id="list-template"><div class="item-wrapper"> <h3 class="title"> <span class='company_name'>#: Company_Name #</span> <span class="title"> <span> #: displayAsCurrency(Approximate_Value, 0) #</span> <a href="{!#LINK.Pipeline_Lead#7450889}&id=#: id #"> <i class="fa fa-chevron-right"></i> </a> </span> </h3> <div class='details'> <ul class="no-ul"> #if(Contact.length > 0) { #<li><span><b>#: Contact #</b></span></li>#}# <li><span>#: Product_Category__Text_ #&nbsp;</span></li> <li> <span style="visibility:hidden;">&nbsp;</span> <div class="followup-date"><span>#: Origin_Date_Str #&nbsp;</span></div> <div class="status">#: status #&nbsp;</div> </li> </ul> </div> <div>&nbsp;</div></div></script><script>kendo.ui.progress($("#rb-content-box"), true); var totalRecords, rowsPerPage, mobileData, isTeam, gridRendered = false, isMobile = rb.newui.util.isMobile(), logonUserId = Number("{!#CURR_USER.id}"), logonUserRole = "{!#CURR_USER.role#code}", totalConfig = "{!#CURR_USER.Totals_To_Display_in_Pipeline#code}", currentPage = 1, startRow = 0, KPICounter = 0, currentUser = { id: logonUserId, Show_in_Pipeline_: '{!#CURR_USER.Show_in_Pipeline_#value}' == 'true' ? true:false, CUSER: null }, listCount = 0, recLoaded = 0; //Global Variable used to track mobile list record countvar contactUrl = "../m/main.jsp?pageId={!#LINK.d_contact1#id}&id=", productUrl = "../m/main.jsp?pageId={!#LINK.Opportunity_Category#id}&id=", accountUrl = "../m/main.jsp?pageId={!#LINK.customer_account#id}&id=", userUrl = "../m/main.jsp?pageId={!#LINK.USER#id}&id=", pipelineUrl = "../m/main.jsp?pageId={!#LINK.Pipeline_Lead#id}&id=", genericPic = "{!#HOSTED_FILE.DZoTZHcFRgSsoyuYN3M7aA#url}";var paramStrip = ["id", "relatedId", "returnId"];var userListIds = [];//{!#LOOP_BEGIN.all#7450931(1)}var addCommentUrl = removeParams("{!#LINK.Pipeline_Lead#actionRPHomKQkQSGRQgwra9r24w}", paramStrip), logCallUrl = removeParams("{!#LINK.Pipeline_Lead#actionqebpuzChTjy4K7dBrf3ufw}", paramStrip), schedAppUrl = removeParams("{!#LINK.Pipeline_Lead#actionhNW2sSQPTFaP__mjBI9elQ}", paramStrip), logAppUrl = removeParams("{!#LINK.Pipeline_Lead#actionsP1mWYKpRZyhljIeK31Pbg}", paramStrip), addTaskUrl = removeParams("{!#LINK.Pipeline_Lead#action7638016}", paramStrip), convertLeadUrl = removeParams("{!#LINK.Pipeline_Lead#actionIM3YG8XaSjaN8rc8dV2ptA}", paramStrip);//{!#LOOP_END.all}var showGroupTotal = totalConfig.indexOf("GT") >= 0, showPageTotal = totalConfig.indexOf("PT") >= 0, showGrandTotal = totalConfig.indexOf("TT") >= 0;function removeParams(sourceURL, keys) { var url = sourceURL; for (var x in keys) { url = removeParam(url, keys[x]); } return url;}
    function removeParam(sourceURL, key) { var rtn = sourceURL.split("?")[0], param, params_arr = [], queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; if (queryString !== "") { params_arr = queryString.split("&"); for (var i = params_arr.length - 1; i >= 0; i -= 1) { param = params_arr.split("=")[0]; if (param === key) { params_arr.splice(i, 1); } } rtn = rtn + "?" + params_arr.join("&"); } return rtn;}
    rb.newui.util.addEventListener(rb.newui.util.customEvents.rbs_pageRender,function(){ togglePipeline(); renderKPIs(); getUsers();});
    function togglePipeline() { if (isMobile) $("#mobile-container").show(); else $("#pipelineGrid").show();}
    function renderKPIs() { setCurrentDates(); renderCombo(); renderProgressBars(); renderCards(); toggleConfigButton(); makeResponsive();}
    function setCurrentDates() { var currentDate = new Date(); $("#currMonth").html( getMonthString(currentDate.getMonth()) ) ; $("#currYear").html( currentDate.getFullYear() );}
    function getMonthString(monthIndex) { var months = ['January','February','March','April','May','June','July','August','September','October','November','December']; return months[monthIndex];}
    function renderCombo() { $("#view").kendoComboBox(); $("#groupBy").kendoComboBox(); $("#show").kendoComboBox(); $("input.comboBoxes").attr("disabled", "disabled"); setSavedGridSettingsData(); setDefaultRow();}
    function setDefaultRow() { defaultRow = "{!#CURR_USER.Pipeline_Grid_Default_Row_Count#code}"; defaultRow = (defaultRow == "") ? "10" : defaultRow; $("#show").data("kendoComboBox").value(defaultRow);}
    function renderProgressBars() { $('#monthlyProgress, #yearlyProgress').kendoProgressBar({ type: "percent", animation: { duration: 0 }, change: function(e) { this.progressWrapper.css({ "background-color": "#8EBC00", "border-color": "#8EBC00" }); } });}
    function renderCards() { var kpiSort = "{!#CURR_USER.Pipeline_KPI_Sort_Order_List#value}"; kpiSort = kpiSort.split(","); for (var count in kpiSort) { $(".responsive").append( $('#card_'+kpiSort[count]) ); } var kpiSect = "{!#CURR_USER.Pipeline_KPI_Section_Display#value}"; $("[id*=card_]").attr('remove',true); if (kpiSect.length > 0) { kpiSect = kpiSect.split(","); KPICounter = kpiSect.length; for (var i in kpiSect) { if(kpiSect == "ACCOUNT") $('#card_A').removeAttr('remove'); if(kpiSect == "CONTACT") $('#card_B').removeAttr('remove'); if(kpiSect == "MONTHLY") $('#card_C').removeAttr('remove'); if(kpiSect == "SALES") $('#card_D').removeAttr('remove'); if(kpiSect == "YEARLY") $('#card_E').removeAttr('remove'); } } $('[remove="true"]').hide().appendTo('body'); if ( $('.customKPI').length > 0 ) { KPICounter += $('.customKPI').length; $('.customKPI').appendTo( $('.responsive') ); } if ($(".card-box").length >= 5) $('.card-box').addClass('card-94'); }
    function toggleConfigButton() { var configLink = "{!#CURR_USER.URL_to_Edit_Home_Section_Display#value}"; if (configLink.length > 0 && !isMobile) { var editSects = $('<a style="font-size: 20px;" id="editSects" data-placement="right" title="Edit Settings of Home and Pipeline Tabs."/>').attr('href', configLink +'&destId={!#PAGE_ID}').html('<span class="fa fa-cog">&nbsp;</span>'); var pipeInfo = $('<a style="margin-left:15px; font-size: 20px;" data-toggle="modal" data-target="#infoModal" data-placement="right" title="Click here for information about the Pipeline Report.">').html('<span class="fa fa-info-circle">&nbsp;</span>'); $('#rb-styleable-content-box').append(pipeInfo); $('#rb-styleable-content-box').append(editSects); pipeInfo.tooltip(); editSects.tooltip(); }}
    function makeResponsive() { if (KPICounter > 0) { $('.responsive').first().slick({ dots: false, infinite: false, centerMode: false, speed: 300, slidesToShow: KPICounter < 5 ? KPICounter:5, slidesToScroll: 1, responsive: [ { breakpoint: 1440, settings: { slidesToShow: KPICounter < 4 ? KPICounter:4, slidesToScroll: KPICounter < 4 ? KPICounter:4 } }, { breakpoint: 1024, settings: { slidesToShow: KPICounter < 3 ? KPICounter:3, slidesToScroll: KPICounter < 3 ? KPICounter:3 } }, { breakpoint: 720, settings: { slidesToShow: KPICounter < 2 ? KPICounter:2, slidesToScroll: KPICounter < 2 ? KPICounter:2 } }, { breakpoint: 640, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); //Added on events on elements so resizing is always active for the slick element(s) /* $(window).on('click resize mousemove', resizeSlick); $(document).on('click resize mousemove', resizeSlick); $('*').on('click resize mousemove', resizeSlick); */ window.setInterval(resizeSlick, 250); //Slick } else $('.responsive').hide();}
    function resizeSlick() { $('.responsive').slick('setPosition'); } //Function to reset the position of the slick container and properly resize slick js element(s) function setCardLinks() { if (isCompany) { $("#contactLink").show().attr('href', '{!#LINK.d_contact1#bGmZY8M5SI2EUHZ9a63dKA}'); $("#contactCountAnchor").attr('href', '{!#LINK.d_contact1#bGmZY8M5SI2EUHZ9a63dKA}'); $("#accountLink").show().attr('href', '{!#LINK.customer_account#generic}'); $("#accountCountAnchor").attr('href', '{!#LINK.customer_account#generic}'); } else if (currentUser.id == Number('{!#CURR_USER.id}') && !isTeam) { $("#contactLink").show().attr('href', '{!#LINK.eXuoX0KlS_WL_6ttTlIk8Q#tab}'); $("#contactCountAnchor").attr('href', '{!#LINK.eXuoX0KlS_WL_6ttTlIk8Q#tab}'); $("#accountLink").show().attr('href', '{!#LINK.4ibr0GjASRWXyeklu9ZMVA#tab}'); $("#accountCountAnchor").attr('href', '{!#LINK.4ibr0GjASRWXyeklu9ZMVA#tab}'); } else { $("#contactLink").hide(); $("#contactCountAnchor").removeAttr('href'); $("#accountLink").hide(); $("#accountCountAnchor").removeAttr('href'); }}
    function setInfoValues() { $("#infoLink").hide(); var logonUser = getUserById(logonUserId); if ((logonUserRole == "$admin" || logonUserRole == "$smanager" || logonUserRole =="$umgmt") || (hasChild(logonUser.CUSER) && logonUser.PUSER === null)) { if (!isCompany && !isTeam) { var lastYearSales = getValue(currentUser.Last_Year_Sales, 0), currentYearTarget = getValue(currentUser.Current_Year_Target_Increase, 0), currentYearSalesGoal = lastYearSales + currentYearTarget, closeRate = getValue(currentUser.Close__, Number("{!#SETTINGS.Default_Close_Percentage#value}")) / 100, retentionRate = getValue(currentUser.Sales_Retention_Rate, Number("{!#SETTINGS.Default_Retainage_Percentage#value}")) / 100, prospectingYear = (lastYearSales + currentYearTarget - (lastYearSales * retentionRate)) / closeRate; if ((lastYearSales != 0 || currentYearTarget != 0) && retentionRate > 0 && closeRate > 0) { $("#infoLink").show(); $("#calcTitle").html( currentUser.firstName + "'s Prospecting Information"); $("#lastYearSales").html( displayAsCurrency(lastYearSales, 0) ); $("#currentYearTarget").html( displayAsCurrency(currentYearTarget, 0) ); $("#currentYearSalesGoal").html( displayAsCurrency(currentYearSalesGoal, 0) ); $("#closeRate").html( (closeRate * 100) + "%" ); $("#retentionRate").html( (retentionRate * 100) + "%" ); $("#prospectingAmount").html( "(" + displayAsCurrency(lastYearSales, 0) + " + " + displayAsCurrency(currentYearTarget, 0) + " - (" + displayAsCurrency(lastYearSales, 0) + " * " + retentionRate + " )) / " + closeRate + " = " + displayAsCurrency(prospectingYear, 0)); } } }} function getUsers() { var opts = { "useLegacyDateFormat": false, "startRow": startRow, "rowsPerPage": 1000, "fieldList": "id,firstName,lastName,Show_in_Pipeline_,CUSER,PUSER,User_Profile_Pic_URL,Last_Year_Sales,Current_Year_Target_Increase,Close__,This_Month_s_Sales,This_Year_s_Sales,Sales_Retention_Rate", "sorting": [ { "field": "name", "order": "asc" } ] } rbf_getViewPage("V4V8WRiuQEiVA_to9tAPsw", setUsers, opts);}
    function setUsers(data) { userData = data; renderPanel();}
    function renderPanel() { var selectedUser = getUserById(logonUserId); if ( isCompanyView(selectedUser.CUSER, selectedUser.Show_in_Pipeline_) ) { //Company view user will be able to select the company (compiled user data) or select any user companyData = { id: 0, Show_in_Pipeline_: true, User_Profile_Pic_URL: "{!#HOSTED_FILE.TsLpBL_4Qh27GaOTkpqyiA}", firstName: "{!#CURR_CUSTM.name#text}", Current_Year_Target_Increase_Percentage: Number("{!#CURR_USER.Company_target_percentage_increase#value}"), lastName: "", CUSER: null }; userData.push(companyData); appendToPanel(companyData, "panel"); renderFilter(); userData.forEach(function(value) { if (value.PUSER === null) { renderPanelItem(value, "panel"); } }); finalizePanel(); setSelectedUser(0, !currentUser.Show_in_Pipeline_); } else if ( selectedUser.Show_in_Pipeline_ && !hasChild(selectedUser.CUSER) ) { //Show in pipe and has no children :: Show Panel without drop-down renderPanelItem(selectedUser, "panel"); finalizePanel(); setSelectedUser(currentUser.id, !currentUser.Show_in_Pipeline_); disablePanel(); //Disable panel if there are no valid selections. } else { //Show in pipe and has children :: Show Panel with drop-down renderFilter(); renderPanelItem(selectedUser, "panel"); finalizePanel(); setSelectedUser(currentUser.id, !currentUser.Show_in_Pipeline_); } }
    function isCompanyView(relUsers, showInPipeline) { return !hasChild(relUsers) && !showInPipeline;}
    function renderPanelItem(user, parentElem) { user.User_Profile_Pic_URL = (user.User_Profile_Pic_URL != "" && user.User_Profile_Pic_URL) ? user.User_Profile_Pic_URL : genericPic; user.firstName = (user.firstName) ? user.firstName : ""; appendToPanel(user, parentElem); for (var x in user.CUSER) { renderPanelItemById(user.CUSER[x], user.id); }}
    function renderPanelItemById(userId, parentElem) { var selectedUser = getUserById(userId); renderPanelItem(selectedUser, parentElem);}
    function finalizePanel() { $(".panel").kendoPanelBar({ animation: { collapse: { duration: 50 }, expand: { duration: 50 } }, expandMode: 'multiple' }); customCss(); $("#panel-wrapper").show(); $("#main").data("kendoPanelBar").bind("expand", focusSearch);}
    function focusSearch() { setTimeout(function(){ $("#userFilter").focus(); }, 50); } function disablePanel() { //Disable panel if there are no children for the current user and not in company view var panelBar = $(".panel").data("kendoPanelBar"); panelBar.collapse($("#main-list")); //Collapse the main list $('.panel').off('click'); //Disable all onclicks of the panel var panelTitle = $("#main-list h2").html(), //Emulate H2 stylings to convert to H1 (sans expand arrow) panelDisp = $('<h1/>').html(panelTitle).css({ 'font-size':'1.6em', 'vertical-align':'middle', 'display':'inline' }); $("#main-list span").eq(1).remove(); //Replace H2 with expand arrow with H1 with same text inside $('#main-list, #main-list *').css('cursor','default'); //Remove cursor pointer so the disabling is completed}
    function getUserById(userId) { var selectedUser = userData.find(function(user) { return (user.id === userId); }); return selectedUser;}
    function appendToPanel(user, parentElem) { var template = kendo.template($("#tree-item").html()); var result = template(user); //Execute the template $("#"+parentElem).append(result); //Append the result}
    function renderFilter() { var template = kendo.template($("#user-filter").html()); $("#panel").append(template);} function setSelectedUser(userId, includeTeam) { isCompany = (userId === 0); isTeam = includeTeam; currentUser = getUserById(userId); if (currentUser.User_Profile_Pic_URL == "") currentUser.User_Profile_Pic_URL = genericPic; currentUser.includeTeam = includeTeam; $("#main").data("kendoPanelBar").collapse($("#main-list")); clearFilters(); $("#rb-tab-content-box").scrollTop(0); setCardLinks(); setInfoValues(); updateLabels(); setUserList();}
    function updateLabels() { if (isCompany){ $("#current-selection").html(currentUser.firstName + "'s Pipeline"); $("#current-img").attr("src", ""); $("#current-img").hide(); $(".dyn_label").html(currentUser.firstName + "'s "); } else if (!isTeam) { $("#current-selection").html(currentUser.firstName + "'s Pipeline"); $("#current-img").attr("src", currentUser.User_Profile_Pic_URL); $("#current-img").show(); $(".dyn_label").html(currentUser.firstName + "'s "); } else { $("#current-selection").html(currentUser.firstName + "'s Team Pipeline"); $("#current-img").hide(); $(".dyn_label").html(currentUser.firstName + "'s Team "); }}
    function setUserList() { userListIds = []; if (currentUser.Show_in_Pipeline_) userListIds.push(currentUser.id); if (!isTeam || !hasChild(currentUser.CUSER) || isCompany) setTotalRecords(); else { renderUsersTree(currentUser.CUSER, true); }}
    function setView() { if (!isMobile) { if ($("#view").val() == "suspect") $("#groupBy").data("kendoComboBox").value("Owner_Name"); } setTotalRecords();}
    var groupTitle; //Text value of the currently selected grouperfunction setTotalRecords() { storeGridSettingsData(); getCardValues(); rbf_getViewCount("72mZ3HwiTjWzmy5DZgOHCg", function(data){ totalRecords = data; showVal = $("#show").val(); rowsPerPage = (showVal == "ALL") ? totalRecords : showVal; rowsPerPage = parseInt(rowsPerPage);
    if (isMobile) { var groupBy = $("#groupBy").val(); //get group by field and check if it has a value and set to the group > field property groupBy = (groupBy == "none") ? null : (groupBy == "Origin_Year___Month") ? "Month" : groupBy; //assign null if none is selected for checking groupTitle = $("#groupBy option:selected").text(); //Text value of the currently selected grouper if (!gridRendered) { //This gets reset when changing group by. The group by field doesn't change when the list view isn't fully re-rendered initializeDataSource(); $("#listView").kendoMobileListView({ dataSource: mobileData, pullToRefresh: false, template: kendo.template($("#list-template").html()), headerTemplate: groupBy == "Month" ? "#: getMonthlyGrouping(value) #" : "#: checkTitle(value) #", //Check if set to month and convert to Month Year format for display fixedHeaders: true, autoBind: false, dataBound: checkData }); var app = new kendo.mobile.Application($("#mobile-container"), { useNativeScrolling: true }); gridRendered = true; } if (groupBy) { //Check if there is a selected grouper and assign mobileData.group({ field: groupBy, dir: groupBy == "Month" ? 'desc':'asc' }); //Assign group field. For month descending (latest on top). Alpha for everything else } else mobileData.group([]); //Remove grouping if there isn't any var listview = $("#listView").data("kendoMobileListView"); listview.dataSource.page(0); customLoader(); } else if (!gridRendered) renderGrid(); else { var gridDataSource = $("#grid").data("kendoGrid").dataSource; gridDataSource.query({ page: getPage(gridDataSource.page()), pageSize: rowsPerPage, group: getGrouping(), sort: gridDataSource.sort(), aggregate: [ { field: "Approximate_Value", aggregate: "groupTotal" } ] }); } }, { "filtering": getFilterOpts() });}
    function toggleFooter() { toggleElement(".k-group-footer", showGroupTotal); toggleElement(".k-grid-footer", showPageTotal || showGrandTotal); //toggleElement("#pageTotal", showPageTotal); //toggleElement("#grandTotal", showGrandTotal);}
    function toggleElement(selector, isDisplayed) { if ( isDisplayed ) $(selector).show(); else $(selector).hide();}
    function getPage(currentPage) { maxPage = Math.ceil(totalRecords / rowsPerPage); if (currentPage > maxPage) return maxPage; return totalRecords > 0 && currentPage != 0 ? currentPage : 1; //Check for records, if at least 1 record exists and current page is 0, set to 1}
    function getCardValues() { getAccountCount(); getContactCount(); getUserTotals(); displayTotals();}
    function getAccountCount() { rbf_getViewCount(44669, function(data){ $("#accountCountAnchor").html(data); }, { "filtering": getPipelineFiltering("RAccount_Owner", "IN", userListIds.toString(), "AND") });}
    function getContactCount() { rbf_getViewCount(106819221, function(data){ $("#contactCountAnchor").html(data); }, { "filtering": getPipelineFiltering("RContact_Owner", "IN", userListIds.toString(), "AND") });}
    function getPipelineFiltering(field, opCode, value, joinType) { if (isCompany) return null; var filters = []; filters.push( getPipelineFilter(field, opCode, value) ) return { "filters": filters, "joinType": joinType }}
    function getPipelineFilter(field, opCode, value) { return { "field": field, "opCode": opCode, "value": value }}
    function getUserTotals() { totalProspectingYear = 0; totalSales = 0; totalInc = 0; currMonthSales = 0; currYearSales = 0; counter=0; userData.forEach(function(element) { if (userListIds.indexOf(element.id) >= 0 || (isCompany && element.Show_in_Pipeline_)) { counter++; prospectingYear = computeProspectingYear(element.Last_Year_Sales, element.Current_Year_Target_Increase, element.Close__, element.Sales_Retention_Rate); if (!(isNaN(prospectingYear))) totalProspectingYear += Math.round(prospectingYear); if (!(isNaN(element.Last_Year_Sales))) totalSales += element.Last_Year_Sales; if (!(isNaN(element.Current_Year_Target_Increase))) totalInc += element.Current_Year_Target_Increase; if (!(isNaN(element.This_Month_s_Sales))) currMonthSales += element.This_Month_s_Sales; if (!(isNaN(element.This_Year_s_Sales))) currYearSales += element.This_Year_s_Sales; } }) totalProspectingMonth = totalProspectingYear/12; totalIncPercent = (totalSales != 0) ? (totalInc / totalSales) * 100 : 0; totalIncPercent = (isCompany) ? companyData.Current_Year_Target_Increase_Percentage : totalIncPercent; percentMonth = (currMonthSales/totalProspectingMonth)*100; percentYear = (currYearSales/(totalProspectingMonth*12))*100;}
    function computeProspectingYear(lastYear, increase, closePercent, retainPercent) { closePercent = getValue(closePercent, Number("{!#SETTINGS.Default_Close_Percentage#value}")); retainPercent = getValue(retainPercent, Number("{!#SETTINGS.Default_Retainage_Percentage#value}")); var retainedSales = lastYear * (retainPercent/100), salesNeeded = lastYear + increase - retainedSales; return (salesNeeded / (closePercent/100));}
    function getValue(userValue, companyValue) { if (userValue <= 0 || userValue == "" || userValue == null) return companyValue; return userValue; }
    function displayAsCurrency(value, decimalCount) { var value = (value) ? value : 0; var currencyValue = rbf_formatCurrency( value, '$ ', true, decimalCount); return currencyValue;}
    function displayTotals() { if (totalIncPercent == 0) { $('#salesInc').css('visibility','hidden').parent().prev().prev().css('padding-top','20px').css('padding-bottom','0px'); } else { if (totalIncPercent > 0) { totalIncPercent = rbf_formatNumber(totalIncPercent, 2) + '% Up From Last Year'; $('#salesInc').css('color','#228b22'); } else { totalIncPercent = rbf_formatNumber(totalIncPercent, 2) + '% Down From Last Year'; $('#salesInc').css('color','#b22222'); }
    //$('#salesInc').css('visibility','visible').parent().prev().prev().css('padding-bottom','5px').css('padding-top','10px'); }
    $('#salesInc').html(totalIncPercent); //Set formatted Sales increase percentage $("#monthProspect").html(displayAsCurrency(totalProspectingMonth, 0)); $("#yearProspect").html(displayAsCurrency(totalProspectingYear, 0)); $("#salesGoal").html(displayAsCurrency((totalSales + totalInc), 0));
    if (totalProspectingMonth > 0 && percentMonth > 1) { $("#monthlyProgress").data("kendoProgressBar").value( percentMonth ); $("#monthlyProgress").show().parent().css('margin-top', '0px'); } else { $("#monthlyProgress").hide(); $("#monthProspect").parent().css('margin-top', '20px'); } if (totalProspectingYear > 0 && percentYear > 0) { $("#yearlyProgress").data("kendoProgressBar").value( percentYear ); $("#yearlyProgress").show(); $("#yearlyProgress").show().parent().css('margin-top', '0px'); } else { $("#yearlyProgress").hide(); $("#yearProspect").parent().css('margin-top', '20px'); }}
    function renderUsersTree(users, mainRequest) { for (var x in users) { result = getUserById(users[x]); if (result.Show_in_Pipeline_) userListIds.push(result.id); if (hasChild(result.CUSER)) renderUsersTree(result.CUSER); if (mainRequest == true && users.length-1 == x) setTotalRecords(); }}
    function hasChild(child) { if (child != null) { if (child.length > 0) return true; } return false;}
    function initializeDataSource() { mobileData = new kendo.data.DataSource({ transport: { read: function(options) { startRow = options.data.skip; currentPage = options.data.page; rbf_getViewPage("72mZ3HwiTjWzmy5DZgOHCg", function(data){ options.success(data); }, { "useLegacyDateFormat": false, "startRow": startRow, "rowsPerPage": rowsPerPage + recLoaded, //Add additional records for viewing depending on how many More... clicks the user has performed "fieldList": "id,Origin_Date,Target__Text_,Company_Name,R7453957,Account_Name,R7453981,Contact,R7453781,Product_Category__Text_,Approximate_Value,status,Lead_Type__Text_,Follow_Up_Date,RPipeline_User,Owner_Name,Month,Origin_Year___Month", "filtering": getFilterOpts(), "sorting": getSortingOpts(options.data.sort) }); } }, schema: { total: function () { return totalRecords; }, model: { fields: { id: { type: "number" }, Origin_Date: { type: "date" }, Target__Text_: { type: "string" }, Company_Name: { type: "string" }, Contact: { type: "string" }, R7453981: { type: "number" }, Account_Name: { type: "string" }, R7453957: { type: "number" }, Product_Category__Text_: { type: "string" }, R7453781: { type: "number" }, Approximate_Value: { type: "currency" }, status: { type: "string" }, Lead_Type__Text_: { type: "string" }, RPipeline_User: { type: "number" }, Follow_Up_Date: { type: "date" }, Month: { type: "string" }, Owner_Name: { type: "string" } } }, parse: function(response) { var leads = []; for (var i = 0; i < response.length; i++) { response.Approximate_Value = (response.Approximate_Value) ? response.Approximate_Value : 0; response.Contact = (response.Contact) ? response.Contact : ''; response.Origin_Date_Str = (response.Origin_Date) ? kendo.toString(new Date(response.Origin_Date), "d") : ''; response.Origin_Date = (response.Origin_Date) ? new Date(response.Origin_Date) : ''; //Grouping Fields - use N/A instead of blank or undefined values response.Month = (response.Origin_Year___Month) ? unescape(response[i].Origin_Year___Month) : ''; response[i].Company_Name = (response[i].Company_Name) ? unescape(response[i].Company_Name) : ''; response[i].Target__Text_ = (response[i].Target__Text_) ? unescape(response[i].Target__Text_) : ''; response[i].Product_Category__Text_ = (response[i].Product_Category__Text_) ? unescape(response[i].Product_Category__Text_) : ''; response[i].Lead_Type__Text_ = (response[i].Lead_Type__Text_) ? unescape(response[i].Lead_Type__Text_) : ''; response[i].status = (response[i].status) ? unescape(response[i].status) : ''; response[i].Owner_Name = (response[i].Owner_Name) ? unescape(response[i].Owner_Name) : ''; leads.push(response[i]); } return leads; } }, pageSize: rowsPerPage, serverPaging: true, serverFilter: true, serverSorting: true, sort: { field: "Origin_Date", dir: "desc" } });}
    function getGridData() { return { page: 1, //Added so grid always starts at page 1 transport: { read: function(options) { startRow = options.data.skip; currentPage = options.data.page; var groupBy = $("#groupBy").val(); var grandTotal = 0; var currentGroupTotal = 0; var listData; rbf_getViewPage("72mZ3HwiTjWzmy5DZgOHCg", function(data) { getGridTotals(0); listData = data; function getGridTotals(index) { if (index <= totalRecords) { rbf_getViewPage("72mZ3HwiTjWzmy5DZgOHCg", function(approxValueData) { approxValueData.forEach(function(value) { grandTotal += (value.Approximate_Value > 0) ? value.Approximate_Value : 0; }) getGridTotals(index+1000); }, { "useLegacyDateFormat": false, "startRow": index, "rowsPerPage": 1000, "fieldList": "Approximate_Value", "filtering": getFilterOpts(), "sorting": getSortingOpts(options.data.sort) }) } else { if (groupBy == "none") { var data = getUngroupedData(listData); if (showGrandTotal) { data.aggregates.Approximate_Value.grandTotal = displayAsCurrency(grandTotal, 0); options.success( listData ); } else { options.success( listData ); } } else { var groupedData = getgroupedData(listData, groupBy); var groupIndexCounter = 0; if (showGrandTotal) { groupedData.aggregates.Approximate_Value.grandTotal = grandTotal; if (showGroupTotal) getGroupTotals(0, 0); else options.success( finalizeGroupedData() ); } else { if (showGroupTotal) getGroupTotals(0, 0); else options.success( finalizeGroupedData() ); }
    function getGroupTotals(groupIndex, recordIndex) { if (groupIndex < groupedData.length) { var filterOps = getFilterOpts(); if (groupBy == "Origin_Year___Month") { filterOps.filters.push({ "field": groupBy, "opCode": "EQ", "value": groupedData[groupIndex].originalValue }); } else if (groupedData[groupIndex].value) { filterOps.filters.push({ "field": groupBy, "opCode": "EQ", "value": groupedData[groupIndex].value }); } else { filterOps.filters.push({ "field": groupBy, "opCode": "EQ", "value": "-Not Specified-" }); } rbf_getViewCount("72mZ3HwiTjWzmy5DZgOHCg", function(groupCount){ if(recordIndex < groupCount) { rbf_getViewPage("72mZ3HwiTjWzmy5DZgOHCg", function(approxValueData) { approxValueData.forEach(function(value) { currentGroupTotal += (value.Approximate_Value > 0) ? value.Approximate_Value : 0; }) groupedData[groupIndex].aggregates.Approximate_Value.groupTotal = displayAsCurrency(currentGroupTotal, 0); getGroupTotals(groupIndex, recordIndex+1000); }, { "useLegacyDateFormat": false, "startRow": recordIndex, "rowsPerPage": 1000, "fieldList": "Approximate_Value", "filtering": filterOps, "sorting": getSortingOpts(options.data.sort) }); } else { currentGroupTotal = 0; getGroupTotals(groupIndex+1, 0); } }, { "useLegacyDateFormat": false, "startRow": recordIndex, "rowsPerPage": 1000, "fieldList": "Approximate_Value", "filtering": filterOps, "sorting": getSortingOpts(options.data.sort) }) } else { options.success( finalizeGroupedData() ); } }
    function finalizeGroupedData() { var pageTotal = (groupedData.aggregates.Approximate_Value.pageTotal) ? groupedData.aggregates.Approximate_Value.pageTotal : 0; var grandTotal = (groupedData.aggregates.Approximate_Value.grandTotal) ? groupedData.aggregates.Approximate_Value.grandTotal : 0; return { groups: groupedData, aggregates: { Approximate_Value: { pageTotal: displayAsCurrency(pageTotal, 0), grandTotal: displayAsCurrency(grandTotal, 0) } } } } } } } }, getOpts(startRow, options.data.sort)); } }, schema: { total: function () { return totalRecords; }, model: { fields: { id: { type: "number" }, Origin_Date: { type: "date" }, Target__Text_: { type: "string" }, Company_Name: { type: "string" }, Contact: { type: "string" }, R7453981: { type: "number" }, Account_Name: { type: "string" }, R7453957: { type: "number" }, Product_Category__Text_: { type: "string" }, R7453781: { type: "number" }, Approximate_Value: { type: "currency" }, status: { type: "string" }, Lead_Type__Text_: { type: "string" }, RPipeline_User: { type: "number" }, Follow_Up_Date: { type: "date" }, Month: { type: "string" } } }, groups: function(response) { console.log(groups); var groups = response.groups.filter(function(value){ return value.items.length > 0; }) return groups; }, aggregates: function(response) { return response.aggregates; } }, group: getGrouping(), aggregate: [ { field: "Approximate_Value", aggregate: "groupTotal" } ], pageSize: rowsPerPage, serverPaging: true, serverFilter: true, serverSorting: true, serverGrouping: true, serverAggregates: true, sort: { field: "Origin_Date", dir: "desc" } }}
    function getUngroupedData(data) { var pageTotal = 0; if (showPageTotal) { data.forEach(function(value){ pageTotal += (value.Approximate_Value) ? value.Approximate_Value : 0; }) } data.aggregates = { Approximate_Value: { pageTotal: displayAsCurrency(pageTotal, 0) }} return data;}
    function getgroupedData(data, groupBy) { //Logic to make grouping work with sorting var groupIndex; var groups = []; var groupedData = []; var groupField = (groupBy == "Origin_Year___Month") ? "Month" : groupBy; var pageTotal = 0; var groupValue; data.forEach(function(value){ groupValue = (groupBy == "Origin_Year___Month") ? getMonthlyGrouping(value.Origin_Year___Month) : value[groupBy]; if (groups.indexOf(groupValue) == -1) { groups.push(groupValue); groupedData.push({ field: groupField, value: groupValue, items: [], hasSubgroups: false, originalValue: value[groupBy], aggregates: { Approximate_Value: { groupTotal: 0 }} }) } groupIndex = groupedData.findIndex(function(group) { return group.value == groupValue; }) groupedData[groupIndex].items.push(value); pageTotal += (value.Approximate_Value) ? value.Approximate_Value : 0; }) groupedData.aggregates = { Approximate_Value: { pageTotal: pageTotal }} return groupedData;}
    function getMonthlyGrouping(dateInt) { var dateString = String(dateInt); var month = dateString.slice(-2); var year = dateString.substr(0, 4); if (dateInt) { return getMonthString( parseInt(month, 10) - 1) + " " + year; } return "";}
    function getSQLQuery() { var sqlQuery = "SELECT SUM(Approximate_Value) FROM Pipeline_Lead WHERE "; var view = $("#view").val(); if (view == "suspect") sqlQuery += "Target = 'S' "; else sqlQuery += "Target <> 'S' "; if (view == "open") sqlQuery += "AND status IN ('Open', 'Bid') "; if (!isCompany) { if (!currentUser.includeTeam) { sqlQuery += "AND RPipeline_User = " + currentUser.id + " "; } else { if (userListIds.length > 0) sqlQuery += "AND RPipeline_User IN (" + userListIds.toString() + ") "; else sqlQuery += "AND RPipeline_User = 0 "; } }
    var filterVal = $("#filter").val(); if (filterVal != "") { sqlQuery += "AND Filter_Field LIKE '%" + filterVal + "%'"; } return sqlQuery;} function checkTitle(value) { //Check if there is a value, if there is no value have No [title] displayed for visual purposes if (String(value.length) == 0) return "No " + groupTitle; else return value;}
    function renderGrid() { $("#grid").kendoGrid({ dataSource: getGridData(), pageable: { input: true, numeric: false, autoBind: false }, scrollable: false, sortable: true, sortable: { mode: "multiple", allowUnsort: true }, showGroupPanel: false, filterable: false, columns: [ { field: "id", hidden: true }, { field: "action", title: "Next Step", /*width: 95, */template: kendo.template($("#next-action").html()), sortable: false }, { field: "Origin_Date", title: "Origin Date", format: "{0:d}", /*width: 90, */sortable: { initialDirection: "desc" }}, { field: "Target__Text_", title: "Target"/*, width: 70 */}, { field: "Company_Name", title: "Company",/* width: 100, */ template: function(dataItem) { if (dataItem.Company_Name) { if (dataItem.Target__Text_ == "Customer" || dataItem.Target__Text_ == "Prospect") { if (dataItem.Account_Name) return "<a target='_blank' href='"+ accountUrl+dataItem.R7453957 +"'>" + kendo.htmlEncode(dataItem.Account_Name) + " </a>"; else return ""; } else if (dataItem.Company_Name) return dataItem.Company_Name; } else return ""; }, sortable: { compare: function(a, b) { if (a.Target__Text_ == "Customer" || a.Target__Text_ == "Prospect") value1 = a.Account_Name; else value1 = a.Company_Name; if (b.Target__Text_ == "Customer" || b.Target__Text_ == "Prospect") value2 = b.Account_Name; else value2 = b.Company_Name; return value1 - value2; } } }, { field: "R7453981", /*width: 100, */hidden: true }, { field: "Contact", title: "Contact", /*width: 100, */template: function(dataItem) { if (dataItem.R7453981 && dataItem.Contact) return "<a target='_blank' href='"+ contactUrl+dataItem.R7453981 +"'>" + kendo.htmlEncode(dataItem.Contact) + "</a>"; return ""; }, sortable: { compare: function(a, b) { return a.Contact - b.Contact; } } }, { field: "R7453781",/* width: 100,*/ hidden: true}, { field: "Product_Category__Text_", title: "Product Code", /*width: 100, */template: function(dataItem) { if (dataItem.Product_Category__Text_) return unescape(dataItem.Product_Category__Text_); return ""; }}, { field: "Approximate_Value", title: "Approx Value",/* width: 120, */groupFooterTemplate: "<div align='right'>Total: #= groupTotal #</div>", footerTemplate: function(dataItem){ var footer = ""; if ( showPageTotal ) footer += "<div align='right' id='pageTotal'>Page Total: "+ dataItem.Approximate_Value.pageTotal +"</div>"; if ( showGrandTotal ) footer += "<div align='right' id='grandTotal'>Grand Total: "+ dataItem.Approximate_Value.grandTotal +"</div>"; return footer; }, template: function(dataItem){ return "<a class='right' target='_blank' href='"+ pipelineUrl+dataItem.id +"'>" + displayAsCurrency(dataItem.Approximate_Value, 0) + "</a>"; } }, { field: "status", title: "Status"/*, width: 65*/ }, { field: "Lead_Type__Text_", title: "Lead Type"/*, width: 85*/ }, { field: "RPipeline_User",/* width: 100,*/ hidden: true }, { field: "Follow_Up_Date", title: "Next Follow Up", format: "{0:d}",/* width: 105, */ sortable: { compare: function(a, b) { return a.Follow_Up_Date - b.Follow_Up_Date; } } }, { field: "Owner_Name", title: "Pipeline Owner",/* width: 100, */template: function(dataItem) { if (dataItem.RPipeline_User && dataItem.Owner_Name) return "<a target='_blank' href='"+ userUrl+dataItem.RPipeline_User +"'>" + kendo.htmlEncode(dataItem.Owner_Name) + "</a>"; return ""; }}, { field: "Month", title: "Month", hidden: true } ], sort: function(e) { var sortCount = 0; var currentField = e.sort.field; var currentDir = e.sort.dir; if (currentDir) sortCount++; e.sender.dataSource.sort().forEach(function(value){ if (value.field != currentField) sortCount++; }) if (sortCount >= 3) { rbf_growlInfo("Maximum number of sort options selected.", "You can only sort by 2 columns at the same time. Please unset one of your existing sorts by clicking on the column heading and try again.") e.preventDefault(); } }, dataBound: onDataBound });}
    function getOpts(startRow, sorting) { return { "useLegacyDateFormat": false, "startRow": startRow, "rowsPerPage": rowsPerPage, "fieldList": "id,Origin_Date,Target__Text_,Company_Name,R7453957,Account_Name,R7453981,Contact,R7453781,Product_Category__Text_,Approximate_Value,status,Lead_Type__Text_,Follow_Up_Date,RPipeline_User,Owner_Name,Month,Origin_Year___Month", "filtering": getFilterOpts(), "sorting": getSortingOpts(sorting) }}
    function getFilterOpts() { var filterOpts = {}; var dateFilter = getDateFilters(); if (dateFilter) { filterOpts['dateFilter'] = [{ "field": "Origin_Date", "value": dateFilter }] } filterOpts['filters'] = getFilters(); filterOpts['joinType'] = "AND"; return filterOpts;}
    function getDateFilters() { var view = $("#view").val(); switch (view) { case "curMonth": return "MONTH|MONTH+1"; break; case "curYear": return "YEAR|YEAR+1"; break; case "last12": return "MONTH-12|MONTH"; break; case "last24": return "MONTH-24|MONTH"; break; default: return; }}
    function getFilters() { var filters = []; var view = $("#view").val(); if (view == "suspect") filters.push( getPipelineFilter("Target", "EQ", "S") ); else filters.push( getPipelineFilter("Target", "NEQ", "S") ); if (view == "open") { var openStatusCodes = "#EVAL[ var objName = 'Pipeline_Lead', fieldName = 'status'; openCode = rbv_api.getIdByCode(objName, fieldName, 'Open'); bidCode = rbv_api.getIdByCode(objName, fieldName, 'Bid'); return openCode + ',' + bidCode; ]"; filters.push( getPipelineFilter("status", "IN", openStatusCodes) ); } if (!isCompany) { if (!currentUser.includeTeam) { filters.push( getPipelineFilter("RPipeline_User", "EQ", currentUser.id) ); } else { if (userListIds.length > 0) { filters.push( getPipelineFilter("RPipeline_User", "IN", userListIds.toString()) ); } else { filters.push( getPipelineFilter("RPipeline_User", "EQ", 0) ); } } }
    var filterVal = $("#filter").val(); if (filterVal != "") { filters.push( getPipelineFilter("Filter_Field", "CT", filterVal) ); } return filters;}
    function getSortingOpts(sorting) { var sortingOpts = []; var groupBy = $("#groupBy").val(); if (groupBy != "none") { sortingOpts.push({ "field": groupBy, "order": (groupBy == "Origin_Year___Month") ? "desc" : "asc" }) } else if (isMobile) { sortingOpts.push({ "field": "Origin_Date", "order": "desc" }) } if (sorting) { sorting.forEach(function(value){ sortingOpts.push({ "field": value.field, "order": value.dir }) }) } return sortingOpts; }
    function getGrouping() { var groupBy = $("#groupBy").val(); if (groupBy != "none") { return { field: groupBy, dir: "asc", aggregates: [ { field: "Approximate_Value", aggregate: "groupTotal" } ] } } return [];}
    function onDataBound() { renderMenu(); gridRendered = true; toggleFooter(); customColumnWidth(); customLoader();}
    function renderMenu() { $("#grid").find(".menu").kendoMenu({ openOnClick: true, scrollable: true, popupCollision: 'flip' });} function customColumnWidth() { var grid = $("#grid").data("kendoGrid"); for (var count in grid.columns) { grid.autoFitColumn(count); } //Auto-fit column script} function customLoader() { if (totalIncPercent != 0) $('#salesInc').css('visibility','visible').parent().prev().prev().css('padding-bottom','5px').css('padding-top','10px'); kendo.ui.progress($("#rb-content-box"), false); $('#rb-tab-content-box').css('visibility','visible');} function customCss() { $("#panel img").first().css({"border": 0, "border-radius": 0}) $("#main-list span").eq(1).css({ "float": "right", "color": "#000", "margin-left": "10px", "margin-top": "0px", "height": "40px", "vertical-align": "middle", "font-size": "1.7em" }); $(".teamTitle").parent().addClass('teamElem');}
    function storeGridSettingsData() { if ( checkStorage() ) { localStorage.setItem("view", $("#view").val()); localStorage.setItem("groupBy", $("#groupBy").val()); }}
    function setSavedGridSettingsData() { if ( checkStorage ) { var view = localStorage.getItem("view"); var group = localStorage.getItem("groupBy"); var url = window.location; if (view !== null) { $("#view").data("kendoComboBox").value(view); } if (group !== null && group !== "0" && group !== "1") { $("#groupBy").data("kendoComboBox").value(group); } }}
    function checkStorage() { return (typeof(Storage) !== "undefined");}
    function checkData(e) { $("#listLoadMore").hide(); //hide load more if all conditions fail if(this.dataSource.data().length == 0){ //No Data Handler //$("#listView").append('<div class="item-wrapper"><h3 class="title"><span class="company_name"> No record found! </span></h3></div>'); $("#listView").append('<div class="rbs-card-no-record km-nova"><h2>No records to display.</h2></div>'); } else { //Load more data handler var listview = $("#listView").data("kendoMobileListView"); listCount = listview.dataSource.total(); //Get total record count if (rowsPerPage != "ALL") { //check how many records is set to display if (listCount > (rowsPerPage + recLoaded) ) { //compare selection with rows per page + records loaded via More... $("#listLoadMore").show(); //Show load more when applicable } } }}
    function listLoadMore() { recLoaded += rowsPerPage; //Increment loaded records by by number of rows setTotalRecords(); //Reset the list view with a higher record count if ( (rowsPerPage + recLoaded) >= listCount) $("#listLoadMore").hide(); //hide load more if all records are shown}
    function resetLoaded() { //reset More... clicks when the Show drop down is changed. recLoaded = 0;} function filterUsers() { var userFilter = $("#userFilter").val(); if (!userFilter) $(".user-item").hide(); $(".locked").removeClass("locked"); userData.forEach(function(user){ if ( isMatch(user.firstName) || isMatch(user.lastName) ) { $("#item_"+user.id).show(); $("#item_"+user.id).parents("[id^='item_']").show().addClass("locked"); } else $("#item_"+user.id+":not(.locked)").hide(); }) function isMatch(value) { if (value) return (String(value).toLowerCase()).indexOf(String(userFilter).toLowerCase()) >= 0; return false; }} function clearFilters() { $("#userFilter").val(""); filterUsers();} function filterChange(e) { if(e.keyCode === 13){ filterUsers(); }} </script>

    [url="https://community.progress.com/thread/34949?ContentTypeID=0"]Continue reading...[/url][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]

Compartilhe esta Página