Yii Framework Forum: Tlbexcelview-Related Discussion, Questions, And Issues - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Tlbexcelview-Related Discussion, Questions, And Issues Please use this thread for any issue related to tlbExcelView widget Rate Topic: -----

#41 User is offline   aliabdzad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-July 13

Posted 03 September 2013 - 05:46 AM

View Postdavelaser, on 18 June 2013 - 06:45 PM, said:

Hello again,

Is there a way to do more detailed formatting in tlbExcelView?

I'd like to add images and display data similar to something like this.

PHPExcel Demo


i need it too ... plz help
davelaser do you get your answer ?
0

#42 User is offline   aliabdzad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-July 13

Posted 04 September 2013 - 08:39 AM

View Postdavelaser, on 18 June 2013 - 06:45 PM, said:

Hello again,

Is there a way to do more detailed formatting in tlbExcelView?

I'd like to add images and display data similar to something like this.

PHPExcel Demo

hi again
i find the way to do this ... it's simple... ;) ... if you want i can help u dear davelaser
0

#43 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 04 September 2013 - 09:15 AM

@aliabzad I think it would be helpful for anyone ;) please post your solution, or if you blog about it somewhere, it would be really nice that you post the link to your post.

Cheers!
0

#44 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 218
  • Joined: 26-September 09

Posted 08 September 2013 - 09:35 PM

Hi,

I got two problem:

a. I set the value of the column to a float by calling floatval(). However, the column does not formatted to xxx,xxx,xxx.00. If I am using result from number_format, it will be treated as string not a number. How should I fix this? My final objective is not just return the value but also show the value in red and within parentheses when negative.

2. In addition, I would like to add a title on top of the table. How could I do that? Since I am using this for ledger, I would like to add information abot the header of the table in excel, for example "Account No : ...., Beginning Date : ...., End date : ...."


Thank you in advance.
0

#45 User is offline   aliabdzad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-July 13

Posted 09 September 2013 - 06:45 AM

View Postbennouna, on 04 September 2013 - 09:15 AM, said:

@aliabzad I think it would be helpful for anyone ;) please post your solution, or if you blog about it somewhere, it would be really nice that you post the link to your post.

Cheers!


ok ;) ... i'll post it in this topic in this week my friend
0

#46 User is offline   aliabdzad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-July 13

Posted 09 September 2013 - 06:59 AM

hi all again
i have new question
please help me to do this my friends ;)
i want to get excel file from my informtion after i had searched it ... when i submit the button the exported excel file has all of the information but i want just searched result information , as you know search is enabled in CGridView ... tanx in advance
0

#47 User is offline   aliabdzad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-July 13

Posted 09 September 2013 - 07:03 AM

View PostDaniel, on 08 September 2013 - 09:35 PM, said:

Hi,

I got two problem:

a. I set the value of the column to a float by calling floatval(). However, the column does not formatted to xxx,xxx,xxx.00. If I am using result from number_format, it will be treated as string not a number. How should I fix this? My final objective is not just return the value but also show the value in red and within parentheses when negative.

2. In addition, I would like to add a title on top of the table. How could I do that? Since I am using this for ledger, I would like to add information abot the header of the table in excel, for example "Account No : ...., Beginning Date : ...., End date : ...."


Thank you in advance.


Daniel ... your problem will solve if you use template for your excel ... now i'm very busy ... i try to post the way to use templates very soon ;)
0

#48 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 09 September 2013 - 07:27 AM

View Postaliabdzad, on 09 September 2013 - 06:59 AM, said:

hi all again
i have new question
please help me to do this my friends ;)
i want to get excel file from my informtion after i had searched it ... when i submit the button the exported excel file has all of the information but i want just searched result information , as you know search is enabled in CGridView ... tanx in advance


Hello aliabdzad,

The sample code in the extension page already does what you need (it's for apps with urlFormat = 'path'):

<?php Yii::app()->clientScript->registerScript('search', "
    $('#exportToExcel').click(function(){
        window.location = '". $this->createUrl('admin')  . "?' + $(this).parents('form').serialize() + '&export=true';
        return false;
    });
    $('.search-form form').submit(function(){
        $.fn.yiiGridView.update('some-grid', {
            data: $(this).serialize()
        });
        return false;
    });
"); ?>

…

<div class="search-form" style="display:block">
<?php $this->renderPartial('_search', array(
    'model' => $model,
)); ?>
</div><!-- search-form -->
 
…

<?php $form = $this->beginWidget('GxActiveForm', array(
    'action' => Yii::app()->createUrl($this->route),
    'method' => 'get',
)); ?>

…

    <div class="row buttons">
        <?php echo GxHtml::submitButton(Yii::t('app', 'Search')); ?>
        <?php echo GxHtml::button(Yii::t('app', 'Export to Excel (xls)'), array(
            'id' => 'exportToExcel',
        )); ?>
    </div>
<?php $this->endWidget(); ?>

0

#49 User is offline   aliabdzad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 23-July 13

Posted 22 October 2013 - 02:18 AM

hi my friends ... how we can save excel as excel2010 or upper like 2013 ? tanx
0

#50 User is offline   rangganovsky 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 15-October 12

Posted 22 October 2013 - 09:46 PM

Hi bennouna,
thanks for this great extension, i just wandering is it possible for us to export the excel outside the search form (in the bottom of the grid for example)? i mean, user can export the grid to excel with already filtered dataprovider (if they do the filter or search.)

because, for now, we use form.serialize() so we need to put it inside the search_form right (CMIIW)?

and another question is about, is it possible to modify the header of the file? i mean, can we add a title before render the column header?


Thanks,

Rangganovsky
0

#51 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 23 October 2013 - 01:22 AM

Hi Rangganovsky,

1. Yes, I guess you can put the button outside the search form if you like, and modify the script accordingly to include the values of the filter fields instead:

<?php Yii::app()->clientScript->registerScript('search', "
    $('#exportToExcel').click(function(){
        // Edit: specify the field controls since there's no form wrapper in the grid filter header.
        // Reminder: jQuery’s .serialize() method applies only on a form or its child controls / nodes
        window.location = '". $this->createUrl('admin')  . "?' + $('table.items tr.filters input, table.items tr.filters select').serialize() + '&export=true';
        return false;
    });

    $('.search-form form').submit(function(){
        $.fn.yiiGridView.update('some-grid', {
            data: $(this).serialize()
        });
        return false;
    });
"); ?>


2. Yes, it's possible to include a title. Please file an issue in the Github repository so that I can look into it.

Cheers!

Bennouna

This post has been edited by bennouna: 23 October 2013 - 01:30 AM

0

#52 User is offline   rangganovsky 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 15-October 12

Posted 24 October 2013 - 09:52 AM

Hi again Bennouna,

thanks for the fast response, but i have a difficulties here. do you mind to explain to me (again) about this code :
window.location = '". $this->createUrl('admin')  . "?' + $('table.items tr.filters input, table.items tr.filters select').serialize() + '&export=true';
        return false;


ok then, i've tried to figure it out. what is table.items? tr.filters input? did you mean we have to change the 'table' to 'our_grid_id'? how the mechanism to wire up the request which is triggered by clicked the export button to our filtered dataprovider in the grid?
sorry if you think that was a silly question coz i'm a bit lost there, as i don't really familiar with jquery things :D.

and also, i've raised an issue in github repository as you suggest, do you mind to take a look it? as it would be a nice feature if we can implemented it and i'm looking forward to it.

edit post :
i have just upload my code to the shared host server. but then, every time i clicked the export button, the error "web page can not be found" always shows up. it is weird, coz i'm able to do this on my localhost. and also the error isn't came from yii (yii not rendering the standard 404 page not found). so i guess it might be something wrong with my shared host config. but i'm not a hundred percent sure, it would be great if anyone here had experienced the same problem and hopefully lead me to the solutions.

many thanks,

Rangganovsky

This post has been edited by rangganovsky: 24 October 2013 - 10:13 AM

0

#53 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 24 October 2013 - 01:52 PM

Hello Rangganovsky,

1. Provided that we use the standard Gii-generated CRUD, the original JS code:

$(this).parents('form').serialize()


applies when the user click on the "Export" button inside the "Advanced search" form. So we just catch that event and we reload the page using the current URL, which we add the serialized search form to. So when you inspect the page in Chrome e.g. you'd get really the resulting JS code:

$('#exportToExcel').click(function(){
        window.location = '/yourController/admin?' + $(this).parents('form').serialize() + '&export=true';
        return false;
    });


Now, maybe I misunderstood, but I thought you wanted to place the Export button elsewhere, and filter using the grid’s filter fields, not the search form. Am I right?

In that case, the parent form doesn't technically exist, unless you extend the search form to wrap the grid… Well, anyway, using the standard CRUD, it is not wrapping it. So we're directly targeting the filter fields, which can be inputs (text / radio / checkbox) or selects, in the header (a "tr" row of class "filters") of the grid, which is a "table" in fact of "items" class.

$('table.items tr.filters input, table.items tr.filters select').serialize()


Well to see what I mean, just inspect a quite standard "admin" output on Yii Playground

2. I saw the issue on gh. Will look into it!

3. Can you post the url of the failing page? You can DM if you prefer.

Bennouna
0

#54 User is offline   rangganovsky 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 15-October 12

Posted 23 November 2013 - 08:49 AM

Hi All,

i just want to share the problem and the solution to solve it. i ran to an issue (that i've shared it to bennouna through Private Message) that i can't export to excel on the Shared Hosting even though all is running well on my local machine. i always get the "Page Not Found" that thrown by the browser.

so. firstly i assume, it should be cause by this lovely extensions (that is why i ask bennouna intensively), but later on, i found that this kind of issue is nothing to do with the tlbexcelview. after do some research, i found that this is issue 'most likely' found at the Shared Hosting using *nix system (My shared hosting using a CentOS though), the root of all the trouble is on the phpexcel/Classes/PHPExcel/Shared/File.php on the sys_get_temp_dir() function to be precise.

the function realpath() is broken in my case, if you take a look on the realpath($pFilename) function there's logic to determine "the path" and for some reasons it can't work on my shared hosting. so i found another solutions and i think it should be more safe to do.

just change the sys_get_temp_dir() function to something like this :
if (self::$_useUploadTempDirectory) {
			//  use upload-directory when defined to allow running on environments having very restricted
			//      open_basedir configs

			//use this instead
			return ini_get('upload_tmp_dir');
		}


and voila, it works like a charm on my shared host :D
i hope it'll help others that get the similar issue to me.


for bennouna : thanks for the all answers that you gave to me mate, and the last thing is any update on my inquiry on github repo (enhancment to add some title before render the header)?

Regards,

Rangganovsky
0

#55 User is offline   bennouna 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,166
  • Joined: 05-January 12
  • Location:Morocco

Posted 23 November 2013 - 11:37 AM

Hello Rangganovsky,

I've been very busy lately but it's really in my task list, and as I told you it's doable, and an interesting feature indeed.

In the meantime, don't hesitate to submit a pull request if you feel like it!

Cheers

Bennouna
0

#56 User is offline   neophyte 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 27-March 14

Posted 26 May 2014 - 09:46 AM

Still can't get working with PDF. All other options are working fine. Can you please explain the exact steps to be followed to download as pdf
0

#57 User is offline   ghadfrf 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 13-May 14

Posted 11 June 2014 - 04:24 AM

error:Alias "protected.components.widgets.tlbExcelView" is invalid. Make sure it points to an existing directory or file.

Followed the same procedure but getting an error.i downloaded tlbexcelview file and placed it in protected/components/widgets folder but getting the error.Not able to identify what is wrong.

Please help me as soon as possible....
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users