⚠ 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

Display_as problem



ThorTheViking
  • profile picture
  • Member

Posted 28 October 2017 - 20:19 PM

I am new to GroceryCrud, but i must admit it is very cool.

 

currently i am having a issue with display_as on columns and fields... i have written in the code, but nothing happens.

 

i have changed it in my controller,( followed example, that was explaining good)

 

do i need to add it somewhere else too? 

 

any configs etc that need to be modified? 

 

grateful for any pointers

 

Thanks


ThorTheViking
  • profile picture
  • Member

Posted 29 October 2017 - 21:18 PM

In application\libraries\Grocery_CRUD.php there is things that make me ask this question.

 

do i need to make changes here for display_as on columns and fields to work correctly

 

protected $display_as = array();    ?

 

since i have written my display_as code in a public function?

 

grateful for any pointers

 

Thanks


Amit Shah
  • profile picture
  • Member

Posted 30 October 2017 - 04:13 AM

Can ou please share the code / output as what is exactly happening? cuz just expressing .. you have written the code and nothing happens - dose not really workout cuz the code is working fine as many of them (including me) have been using the same and never found issue with it..

so recommend u share the piece of code..

and the output that you see .. post that, will be able to help you up.


ThorTheViking
  • profile picture
  • Member

Posted 30 October 2017 - 06:53 AM

Can ou please share the code / output as what is exactly happening? cuz just expressing .. you have written the code and nothing happens - dose not really workout cuz the code is working fine as many of them (including me) have been using the same and never found issue with it..

so recommend u share the piece of code..

and the output that you see .. post that, will be able to help you up.

The code

public function employees_example()
{
$crud = new grocery_CRUD();
 
$crud->set_table('employees');
$crud->columns('lastName','firstName','email','jobTitle');
$crud->fields('lastName','firstName','extension','email','jobTitle');
 
$crud->display_as('lastName','Last Name');
$crud->display_as('firstName','First Name');
$crud->display_as('jobTitle','Job Title');
 
$output = $crud->render();
 
$this->_example_output($output);
}

 

but it does not change the display_as names

 

does this have something to do with the application\libraries\Grocery_CRUD.php

where

protected $display_as = array();

Since it is protected and i have written my code in a public function?

I have been reading a lot but cant find anything about this.

grateful for any help

Thanks


Amit Shah
  • profile picture
  • Member

Posted 30 October 2017 - 07:17 AM

there is nothing for you to do as for converting the protected variable to public or so .. cuz u are not accessing the variable - rather u are accessing the function display_as ...

the only possibility that it dose not look the same - it might be something to do with any set of code changes that would have gone in the library (possibly the view part).

 

Unless the application is not seen up - it will be difficult for anyone here to give you any solution.. if you claim not to have made up any changes in the library (also the assets folder) then i will recommend .. u download the fresh copy of the same and upload the same..