⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

how to display array values in grocery crud in single column



Dharani
  • profile picture
  • Member

Posted 26 February 2018 - 09:21 AM

Hi, I am new to grocery crud... I need to know how to display an array values into single column in grocery_crud...

 

for example ..

I have table which display project name and resource name

 

Project name                           Resource name

 

   xxxx                                                 yyyyy

 

   xxxx                                                 zzzzz

 

 

Now I need to display the resource name in single row...

 

I need a grocery table like this

 

||

v

 

Project name                    Assignee

 

    xxxxx                             yyyyy,zzzz

 

 

 

pls help me... Thanks in advance...


Amit Shah
  • profile picture
  • Member

Posted 26 February 2018 - 09:47 AM

Well - instead of trying to get all the row values in single cell (it can look messy .. and un categorized)...

i will recommend - u write a code to skip the parent (project) column to print it again and again for same value ..

How u can do - do a column callback - add a variable in memory keeping a track of last project name being set. If the current one is same - just ignore - show blank .. else show the project name.. and so on - so forth..

 

u a programmer - u know it better :)..

 

this way u can avoid the extra printing and get desired output.

Writing all values in single rows is a bit tricky code - it may need u to write in yr own model and so on so forth -- plus it might cause some trouble with pagination too.. hence .. the appproach shared above is etter then what you looking for.

 

Happy GCing :)


Dharani
  • profile picture
  • Member

Posted 26 February 2018 - 10:28 AM

Sorry... but i cannot change it .. bcoz the design was fixed by client so we can't change it... I have to deliver the project as it was designed... Thats why i am asking.. anyway thanks  :) ...


Amit Shah
  • profile picture
  • Member

Posted 26 February 2018 - 14:50 PM

well.. then there is another option for you... a simpler one

 

get distinct rows by parent field and make a callback on the child field where u can query up the data to be displayed. There u can return a CSV value!! 

 

Happy GCing :)


Dharani
  • profile picture
  • Member

Posted 27 February 2018 - 09:07 AM

Thanks a lot for your help...

 

I got the result... :)