Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda