Results 1 to 5 of 5

Thread: Bold Keyword Display in GridPanel Texts

  1. #1
    Sencha User sideeque's Avatar
    Join Date
    Aug 2009
    Location
    Washington DC
    Posts
    50

    Question Bold Keyword Display in GridPanel Texts

    I have a GridPanel which displays search result for the Key Word entered in TextField.

    I want to Bold the keyWord text displayed in Grid panel. I dont want to bold complete search result text in Grid.

    Is there anyway or properties with GridPanel of Ext JS helps?
    I use ExtJS with Oracle BPM(Aqualogic) applications

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You will have to write one or more column renderers that puts something like <span class="search-result">...</span> around the searched text.

  3. #3
    Sencha User sideeque's Avatar
    Join Date
    Aug 2009
    Location
    Washington DC
    Posts
    50

    Default

    But each row text is dynamically created based on the data in database. But all the result will have some keyword.

    For example: I am searching for key word "coffee"..... The result will be like

    The coffee is the best one
    The coffee is better than other coffee
    Coffee is good


    How do I make this coffee as BOLD on each row?
    I use ExtJS with Oracle BPM(Aqualogic) applications

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Something like:
    Code:
    var regexp = new RegExp('coffee', 'gi'),
        renderer = function(v) {
            return String(v).replace(regexp, '<span class="search-result">$1</span>');
        },
        col = grid.getColumnModel().getIndexById('id-of-column');
    grid.getColumnModel().setRenderer(col, renderer);
    grid.getView().refresh();
    with css:
    Code:
    .search-result {font-weight: bold;}

  5. #5
    Sencha User sideeque's Avatar
    Join Date
    Aug 2009
    Location
    Washington DC
    Posts
    50

    Default

    This Works. Thanks for your help!
    I use ExtJS with Oracle BPM(Aqualogic) applications

Similar Threads

  1. GridPanel and bold row
    By kez in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 14 Dec 2009, 12:29 PM
  2. How to display a row in bold text.
    By brendahenson in forum Ext 2.x: Help & Discussion
    Replies: 13
    Last Post: 26 Oct 2009, 8:35 AM
  3. How to display every first row in a group, of a Grid in Bold...?
    By brendahenson in forum Community Discussion
    Replies: 0
    Last Post: 20 Oct 2009, 11:42 PM
  4. keyword this not work
    By igi in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 23 Jun 2009, 5:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •