1 (edited by tester1 09/01/2016 12:10:56 pm)

Topic: ASC/DESC on 'fun' / 'ord' NOT WORKING

$result = get_prodlist();

$cols = array(
         'id'=>'skip',
        _("Sr.No.")=>array('align'=>'center','ord'=>''),
        _("Name")=>array('align'=>'center'),
        _("Wgh")=>array('align'=>'center'),
        _("p1")=>array('align'=>'center'),
        _("p2")=>array('align'=>'center'),
        _("p1+p2")=>array('align'=>'center','fun'=>'sumplp2','ord'=>'')
);
$table =&new_db_pager('prodtable', $result, $cols, 'prodtable','id',10);
$table->width = "99%";
display_db_pager($table);

-----BELOW IS FUNCTION -------

function sumplp2($row){
      $p1 = $row['p1'];
      $p2 = $row['p2'];
     
      $totalp1p2 = $p1 + $p2 ;

     return $totalp1p2 ;

}


THAT COLUMN DONT DO ASC/DESC  - ordering .... any solution why function 'ord' column are not working for asc/desc

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

Any solution on above section ......please let me know anyone ....

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

Make sure that the $result is just an sql statement and not the executed resultset.

Check out the last part of sales/inquiry/sales_orders_view.php as an example.

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

@apmuthu,
Thanks For reply ....

i have return " return $sql;  " which same done in sales_orders_view.php.

in my case : my column  result output from a function ( sumplp2 ) : _("p1+p2")=>array('align'=>'center','fun'=>'sumplp2','ord'=>'')

where in sales/inquiry....
_("Order Total") => array('type'=>'amount', 'ord'=>''),  --- this result is coming from its sql statement ...not from any Function.

i even try putting 'type'=>'amount'  thats :  _("p1+p2")=>array('align'=>'center','fun'=>'sumplp2','type'=>'amount', 'ord'=>'')

but still no solution .... when i click on my column name its dont perform any asc/desc just clicking happen

please help me ....

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

Try to make the addition of p1+p2 in the sql statement itself.

List the function get_prodlist() here to see if anything is amiss.
See if $result displays a validly executable sql statement when it is assigned.

6 (edited by tester1 09/06/2016 06:34:58 am)

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

bro ,
i tried that to but not working ....

also what is in function i have called another function value .... then it not work

i means to say

function sumplp2($row){
      $p1 = function p1val($row);
      $p2 = function p2val($row);
     
      $totalp1p2 = $p1['p1'] + $p2['p2'] ;

     return $totalp1p2 ;

}

above one not work only ... you try your self also ....

thanks

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

typo:
funtionp1val => functionp1val

We need to know what is in the functionp1val() as well. Are there any variable missing scope?

Try calling the function ordinarily and see if the values are available.

8 (edited by tester1 09/06/2016 06:35:24 am)

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

Hey,

BRO, my all value are coming properly .... as i need from functions .... just ASC/DESC not happening..
yes that was typo error.... which i have corrected

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

For a test just replace your code with that from sales/inquiry/sales_orders_view.php and see if it displays correctly from your position in the code tree.

Re: ASC/DESC on 'fun' / 'ord' NOT WORKING

I have tried that ....but as said ...value in column are coming form   function within function ....

allow me some time ...i will post my whole CODE of resp. page .... here so that you can to test from your end .... for future development ....