⚠ 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

CREATE A NUMBER OF COLOM



MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 02 July 2013 - 14:26 PM

HOW 2 CREATE NUMBER IN COLOUM DATA IN GRUCERY CRUUD LIKE THIS

CHECK THE PICTURE

 


Amit Shah
  • profile picture
  • Member

Posted 02 July 2013 - 16:35 PM

Well you can create a column callback to the column.

There.. initialize the value that needs to be populated. Usually will be initialized based on the page number * rows to display...

and store the number in session. Every call increment it and store it back in session for next call ..

this way you should achieve it with ease.


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 03 July 2013 - 01:43 AM

can u give me the example ? . . . . i dont understand function callback to the coloum . . . less a simple of the code in grucerycrud.com

 


victor
  • profile picture
  • Member

Posted 03 July 2013 - 08:22 AM

Which theme do you use?


davidoster
  • profile picture
  • Member

Posted 03 July 2013 - 08:33 AM

// in your controller
...
$crud->columns('number','field1',...,'fieldx');
$crud->callback_column('number',array($this,'_callback_number');
...

// callback function
public function _callback_number($value, $row)
{
// calculate the number that needs to be displayed
// you should come up with some kind of algorithm for this
// let's say this algorithm stores the number in variable $number

return '<div class="text-left">' . $number . '</div>';

}

davidoster
  • profile picture
  • Member

Posted 03 July 2013 - 08:37 AM

Which theme do you use?

 

Good point Victor!!!  ;)

Clever thinking!!!


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 03 July 2013 - 12:10 PM

flexi grid sir victor . . . .can u give me exxample . . . i try that code now thx all dude


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 03 July 2013 - 12:25 PM

ur code has eror sir . . . . can u give another ?

 


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 03 July 2013 - 12:31 PM

ur code has eror sir . . . . can u give another ?


victor
  • profile picture
  • Member

Posted 03 July 2013 - 12:51 PM

/topic/1056-how-to-add-autonumber-column-in-flexigrid-theme/


victor
  • profile picture
  • Member

Posted 03 July 2013 - 12:55 PM

but you can make it using callback column


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 03 July 2013 - 22:36 PM

can u give example for callback column ? . . . more easy if i use them . . . :)


victor
  • profile picture
  • Member

Posted 03 July 2013 - 22:43 PM

learn the documentation. 

you can use callback function for the "id" field.

and look at my example from that page.

I have no time to make it for you because I have a lot of work


davidoster
  • profile picture
  • Member

Posted 04 July 2013 - 08:35 AM

ur code has eror sir . . . . can u give another ?

 

 

My code isn't a real code! It is an example! You need to learn how to code first!

Take some programming lessons!


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 04 July 2013 - 12:15 PM

ha ha ha ha i beginer programer sir :) . . . . i will try . . . but can u share the code ?  :D


victor
  • profile picture
  • Member

Posted 05 July 2013 - 09:40 AM

we have no the code.