Jump to content


put the action buttons in first column

flexigrid table action buttons

  • Please log in to reply
3 replies to this topic

#1 Jefer

Jefer

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 30 July 2013 - 03:18 PM

I've been using Grocery Crud for about 5 months and I am very happy with it. However, I need to know if it is possible to put the action buttons (edit, delete buttons) in the table's first column. I am using flexigrid theme.

 

Thanks in advance.



#2 kenshicu

kenshicu

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts
  • LocationHolguín, Cuba

Posted 30 July 2013 - 03:35 PM

edit the file list.php
it found in: "\assets\grocery_crud\themes\flexigrid\views\list.php"

 

in the code, swap the first block of php code, with the second:

		<thead>
			<tr class='hDiv'>
			    //this block
				<?php foreach($columns as $column){?>
				<th width='<?php echo $column_width?>%'>
					<div class="text-left field-sorting <?php if(isset($order_by[0]) &&  $column->field_name == $order_by[0]){?><?php echo $order_by[1]?><?php }?>" 
						rel='<?php echo $column->field_name?>'>
						<?php echo $column->display_as?>
					</div>
				</th>
				<?php }?>
				//with this
				<?php if(!$unset_delete || !$unset_edit || !empty($actions)){?>
				<th align="left" abbr="tools" axis="col1" class="" width='20%'>
					<div class="text-right">
						<?php echo $this->l('list_actions'); ?>
					</div>
				</th>
				<?php }?>
			</tr>
		</thead>

then swap the php code block, which begins thus: <?php foreach($columns as $column){?>

 

with the following php code block that starts well: <?php if(!$unset_delete || !$unset_edit || !empty($actions)){?>   



#3 Jefer

Jefer

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 30 July 2013 - 05:05 PM

@kenshicu You are right, but that change is only for thead. I also had to change the following code to the bottom for the tbody.

 

Thanks!!!

<?php foreach($columns as $column){?>
			<td width='<?php echo $column_width?>%' class='<?php if(isset($order_by[0]) &&  $column->field_name == $order_by[0]){?>sorted<?php }?>'>
				<div class='text-left'><?php echo $row->{$column->field_name} != '' ? $row->{$column->field_name} : '&nbsp;' ; ?></div>
			</td>
			<?php }?>


#4 kenshicu

kenshicu

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts
  • LocationHolguín, Cuba

Posted 01 August 2013 - 04:10 PM

good, but I said at the end:

 

then swap the php code block, which begins thus: <?php foreach($columns as $column){?>

with the following php code block that starts well: <?php if(!$unset_delete || !$unset_edit || !empty($actions)){?>

 

Put another way, (besides change the thead):

 

is, change this:

<?php foreach($list as $num_row => $row){ ?>        
	<tr  <?php if($num_row % 2 == 1){?>class="erow"<?php }?>>
	   <?php foreach($columns as $column){?>
              ...
	    <?php }?>
	    <?php if(!$unset_delete || !$unset_edit || !empty($actions)){?>
              ...
	    <?php }?>
	</tr>
<?php } ?>  

for this:

<?php foreach($list as $num_row => $row){ ?>        
	<tr  <?php if($num_row % 2 == 1){?>class="erow"<?php }?>>
	    <?php if(!$unset_delete || !$unset_edit || !empty($actions)){?>
              ...
	    <?php }?>
	    <?php foreach($columns as $column){?>
              ...
	    <?php }?>
	</tr>
<?php } ?>  






Also tagged with one or more of these keywords: flexigrid, table, action, buttons

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users