⚠ 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

Set length digits?



Димитър Андреев
  • profile picture
  • Member

Posted 25 November 2015 - 15:22 PM

Hello , I want to ask , I have a column of protocol in it are inserted data "1" , "2" , "3" ... I want to table them show to me as follows: " 0000001 ", " 0000002 " .. . " 0000010 .... ie length always has 7 digits ! Can you advise me if he could do such a thing?

Thanks in advance !


Paul Savostin
  • profile picture
  • Member

Posted 26 November 2015 - 16:46 PM

set in database in your column attribute  "UNSIGNED ZEROFILL"


Димитър Андреев
  • profile picture
  • Member

Posted 27 November 2015 - 13:04 PM

Works! Thank you very much!

 

I have just one question when I put "$crud->callback_column('city',array($this,'My_value'));" It is shown in the table, but how to show this and in view list ?

 

Thanks in advance !


Paul Savostin
  • profile picture
  • Member

Posted 27 November 2015 - 13:37 PM

Correct me if I am wrong that is "table" and "view list" the same staff


Димитър Андреев
  • profile picture
  • Member

Posted 27 November 2015 - 14:37 PM

I mean that in the table is added , but if you click the button "View" to see the аll columns there do not add !


Paul Savostin
  • profile picture
  • Member

Posted 27 November 2015 - 15:07 PM

"View" - if u mean read state where u just see readonly info about record so u have >= 1.5 version of GC

new function set_read_fields. For records in view (READ STATE) u need use callback_field


Димитър Андреев
  • profile picture
  • Member

Posted 27 November 2015 - 21:24 PM

I don't understand you.
I set "MyValue" before my entrys and it show view on picture 1.
But in read list don't show it view on list picture 2
How to show "MyValue" and in read list ?

P.S. My version is 1.5.2.

Untitled.png

 

​Untitled2.png


Paul Savostin
  • profile picture
  • Member

Posted 27 November 2015 - 23:01 PM

I dont understand u too man! I never saw view in GC where u have some field on the bottom of your picture!

In list view, u use callback_column in other state like read or edit(insert) u have to use ->callback_field, thats it

P.S. By the way,in GC present function callback_read_field, it just doesnt presents in documentation, so in read state u should use it:)


Димитър Андреев
  • profile picture
  • Member

Posted 28 November 2015 - 08:11 AM

The function "callback_read_field" get error:

 

Fatal error: Call to undefined method Grocery_CRUD::callback_read_field() in C:\xampp\htdocs\data\application\controllers\mycontroller.php on line 24

A PHP Error was encountered

Severity: Error

Message: Call to undefined method Grocery_CRUD::callback_read_field()

Filename: controllers/mycontroller.php

Line Number: 24

Backtrace:

 

If I use function "callback_column" appears only in "View" list.

If I use finction "callback_field" appears only in "Insert" and can not write anything more in this field, but to me you can write for example in the box "Dog" and then on "View" and "Read" lists to be displayed so "MyValueDog" this gives a "callback_column" , but only in "VIew" I need a sheet and in the "Read" list !

 

 

 

 

 

 

 

 

 


​


Paul Savostin
  • profile picture
  • Member

Posted 28 November 2015 - 11:13 AM

Its just some kind of bad magic in GC, in version > 1.4.2 this method presents, anyway u can set this method by yourself using this link https://github.com/scoumbourdis/grocery-crud/pull/299/files


Димитър Андреев
  • profile picture
  • Member

Posted 28 November 2015 - 16:09 PM

Thank you very much! 

 

callback_column + callback_read_field = everything is exactly as I want ! Thank you very much for your time and sorry if I was annoying :) !!!​



Paul Savostin
  • profile picture
  • Member

Posted 28 November 2015 - 19:38 PM

For your pleasure!