Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8031723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:11:54+00:00 2026-06-05T01:11:54+00:00

enter code here I am trying to reproduce the search suggestion in facebook. That

  • 0

enter code hereI am trying to reproduce the search suggestion in facebook. That it shows on the same box results of different ‘types’ with a header (persones, groups, pages, ..)

Basically i need to group the results by type and add a non-cliclable header with the name of the type (example: user, group); Just like facebook does:

enter image description here

This is the custom catcomplete from jquery ui page:

$.widget( "custom.catcomplete", $.ui.autocomplete, {
                                _renderMenu: function( ul, items ) {
                                    var self = this,
                                        currentCategory = "";
                                        $.each( items, function( index, item ) {
                                            if ( item.category != currentCategory ) {
                                                ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
                                                currentCategory = item.category;
                                            }
                                            self._renderItem( ul, item );
                                        });
                                }
                            });

-EDIT-

Can be tested here by typing ‘bootcamp’ on the serch field (no need to login): http:// 209.51.221.243/integracion/login.php (type ‘deya’ works, type ‘bootcamp’ doesn’t work

Wich is working fine when is only one type of results, but when there are more than one, like in this response:

[{"value":"Donde puedo descargar los drivers de bootcamp?","id":"1","category":"Ayudas"}][{"value":"Donde puedo descargar los drivers de bootcamp?","id":"1","category":"Ayudas"},{"first_name":"bootcamp","last_name":"bootcamp","id":"95","value":"bootcamp bootcamp","category":"Usuarios"}]

it doesn’t show any ressult, why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:11:55+00:00Added an answer on June 5, 2026 at 1:11 am

    In your php only add the sub, for the 1st row of each type.
    You can do that with a global variable:

    $first = array();
    
    while (...) {
       if (!$first[$row['type']]) {
           $first[$row['type']] = true;
           $row['sub'] = $row['type'];
       }
    }
    

    then in your javascript:

    .data( "autocomplete" )._renderItem = function( ul, item ) {
                var sub = "";
                if (item.sub) {
                    sub = $("<li class="sub">" + item.sub + "</li>");
                    ul.append(li);
                }
                var li = $( "<li></li>" )
                    .data( "item.autocomplete", item )
                    .append( "<a><img src='"+item.img+"' /><span class='name'>" + item.value + "</span></a>" )
                ul.append(li);
                            };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

enter code here I have a ListView that have a different Layout XML for
enter code here Hi All, I have a simple windows service application that connects
enter code here I am trying to write a query to extract all rows
I'm trying to remove annota enter code here tion some a MKMapView but am
enter code here hi. i am trying to implment custom paging in datalist control
I'm trying to write a mysql class... enter code here class ASQL { public
enter code here hey guys im having trouble with xelement when im trying to
enter code hereI'm trying to finish up Michael Hartl's Ruby on Rails v3.2 Tutorial
enter code here Want to remove items from a Main list , but give
enter code here My jquery ui dialog contains an iframe and has the option

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.