AshishJoshi-asj / zfdatagrid

Automatically exported from code.google.com/p/zfdatagrid
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

No Function for getting URL #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Is there a way to find out the URL to form a link for each row/field?

Why?
I'd like to make a row and/or field link back to Controller e.g.
- to AJAX display the dependent table (master/slave)
- to dynamically AJAX display a Form for current record

How?
In format field callback function for a master table field:
return '<a href="'.currentURL().'/myParam/myValue">{{fieldname}}</a>';

currentURL() would be something like (or similar): 
http://site/basic/edit/1/comm/mode:CUSTOM;[id:36]

Or to have '{{url}}' param that can be passed to callback?
'callback' => array(
  'function' => array($this, 'myFormat'),
  'params' => array('{{phoneHome}}', '{{url}}')) // maybe even a {{PKey}}

What version of the product are you using? On what operating system?
0.6alpha

Please provide any additional information below.
Is there maybe already a way to achieve this? 
I searched the source, but most functions and vars are protected/private.

Original issue reported on code.google.com by vlatko.b...@gmail.com on 14 Feb 2010 at 4:34

GoogleCodeExporter commented 9 years ago
Hi,

Protected mehtod _getUrl is now public

$grid->getUrl();//Receives a options argument of params to be removed 
(string|array)

$grid->getUrl('order'); //Returns the url without the order param

$grid->getUrl(array('order','start')); //Returns the url without the order and 
start
params

Let me know if this is fine for you....

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 14 Feb 2010 at 4:53

GoogleCodeExporter commented 9 years ago
Yes, this looks like I was looking for. I'll have to test some more.

I'm trying to pass zfDatagrid object as a parameter to callback function

 'callback' => array(
   'function' => array($this, 'formatPhNum'),
  'params' => array('{{phoneHome}}', $this->_zfDatagrid))

But I'm getting 
"You must explicity call the deploy() method before printing the object".

Are you converting all parameters to string?

I have many similar fields that can be handled by the same function. That's why 
I ask.

Original comment by vlatko.b...@gmail.com on 14 Feb 2010 at 5:19

GoogleCodeExporter commented 9 years ago
""You must explicity call the deploy() method before printing the object"."

Is throw when you try to print the object without calling the deploy() method 
before

Something like:

$grid = new Bvb_Grid_Data::factory('Bvb_Grid_Deploy_Table');
$grid->query(Zend_Db_Select);

echo $grid;

I can't let you do this, because I need to send some params to the view instance
(append JS).

That happens everywhere or only on certain occasions ?

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 14 Feb 2010 at 5:36

GoogleCodeExporter commented 9 years ago
I wanted to pass the Grid object as a parameter. To use its properties in a 
callback.

 'callback' => array(
   'function' => array($this, 'formatPhNum'),
   'params' => array(
     '{{phoneHome}}', 
     $this->_zfDatagrid, << here the exception occurs
   )) 

Original comment by vlatko.b...@gmail.com on 14 Feb 2010 at 5:42

GoogleCodeExporter commented 9 years ago
Hi,

Please update to Revision 614 and let me know if this works...

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 16 Feb 2010 at 4:52

GoogleCodeExporter commented 9 years ago
Hi,

When defined like this, 

'callback' => array(
    'function' => array($this, 'formatPhNum'),
    'params' => array('{{phoneHome}}', $grid))
));

the second parameter is not passed at all. The function is properly called, but 
with
just one parameter.

if defined as function formatPhNum($num, $grid = NULL), all goes well, but null 
is
received.

But if defined as function formatPhNum($num, $grid), I receive

Warning: Missing argument 2 for Private_Model_Addressbook::formatPhNum() in
C:\...\models\Addressbook.php on line 117

Original comment by vlatko.b...@gmail.com on 16 Feb 2010 at 5:35

GoogleCodeExporter commented 9 years ago
Hi,

Revision 616

I hope this is it...

Best Regards,
Bento Vilas Boas

Original comment by pao.fre...@gmail.com on 16 Feb 2010 at 5:53

GoogleCodeExporter commented 9 years ago
Confirm. Verified. :-)

Original comment by vlatko.b...@gmail.com on 16 Feb 2010 at 6:13

GoogleCodeExporter commented 9 years ago

Original comment by pao.fre...@gmail.com on 17 Feb 2010 at 2:08

GoogleCodeExporter commented 9 years ago

Original comment by bento.vi...@gmail.com on 3 Mar 2010 at 4:56