Removing duplicates and white space between entries

hi experts

I have a Product name column on my UI grid which has data like this


CRBR
CRBR
CRBR
CRBR
CRBR
TESTRAMP
TESTRAMP
TESTRAMP
TESTRAMP
TESTRAMP
OLIVERP
OLIVERP
OLIVERP
OLIVERP

My requirment is to remove duplicates and remove the white space between each product
Currently i have productRenderer on this column

var  productPlaceHolder = {};
function productRenderer(value, meta) {    
    if( !productPlaceHolder[value] ) {  
        productPlaceHolder[value] = true;        
        return value;
    }
    else {
        return  ''; //removes duplicates
    }
}

After i apply the renderer, it displays like this
CRBR




TESTRAMP




OLIVERP




But my requirment is to display like this
CRBR
TESTRAMP
OLIVERP

Any idea how i can remove the white spaces?

Thanks
royjaydAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZvonkoSystems architectCommented:
What UI grid do you use and can you please show some lines around the location where the upper productRenderer function is called?
0
royjaydAuthor Commented:
sure, ext-js.
My grid column is defined as

    var columns = [
              {
            id: 'productId',
            dataIndex: 'productId',
            text: 'Product Id',
            width: 300,
            renderer:productRenderer
              },
]

Thanks.
0
ZvonkoSystems architectCommented:
The renderer prepares the records for display but record by record and one by one where you cannot suppress next record or previous record (of course you technically could but it is bad idea).
Better idea is to create a new Store from existing ExtJs Store with the groupField property set to field name to group to distinct rows.
Look at this and look for groupField and collapsable: false
http://blogs.walkingtree.in/2013/11/09/what-can-i-do-with-a-gridpanel-in-extjs/
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ZvonkoSystems architectCommented:
Which version of ExtJs do you use in that application?
0
royjaydAuthor Commented:
4.2
I have found a way around it which solves my requirment.
thanks.
Any help with my next question will be appreciated.
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28548773.html
0
ZvonkoSystems architectCommented:
"I have found a way around it which solves my requirment"
Can you tell me more?

I ask because you let this question open and open a new question using the hint from above: "Better idea is to create a new Store from existing ExtJs Store "

So either assign the points from here to the proposal http://www.experts-exchange.com/Q_28547572.html#a40413945 or explain what your solution here was or let this question be closed by EE Moderators.

Thanks,
Zvonko
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.