Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
yii2 How to remove unused query parameters from url

I have Kartik gridView and custom filter. After gridfilter in my browser i got URL like

localhost:20024/consignment?fid=&post_code=&pud2_mrn=&pud2_status=PUDP&pud_status=&pud2_remaining_date=&mrn=&mrn_status=&ioss_number=&declaration_type=&status=&entry_at=&exit_at=&created_at=

Is there a way to remove unfilled parameters from url inside YII instead javascript? Or can anybody provide full example of javascript to achieve the goal.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Copy vendor/yiisoft/yii2/yii.gridView.js somewhere under web directory (e.g. web/js and add this line:

$.each(data, function (name, value) { if (value[0].length === 0) data[name] = null; });

prior this line in applyFilter method:

var pos = settings.filterUrl.indexOf('?');

Then add this to web.conf (update paths if you used different place for this js file):

'assetManager' => [
    'bundles' => [
        'yii\grid\GridViewAsset' => [
            'sourcePath' => '@webroot/js',
            'basePath' => '@webroot/js',
            'baseUrl' => 'vendor/js',
        ],
    ],
],

This was you are not modifying anything in the vendor folder.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!