Getting Cgridview Selected Rows And Form Data On Form Submit Using Jquery

hello guys,

I working on Cgridview+form, I need select rows of cgridview and form data when form submits, i.e after applying filters and getting cgridview result i want to save it to Database along with some options from Form , so i need both data.

thanks

When you click to submit button, check




$.fn.yiiGridView.getSelection



I want to do so by jquery/ajax, like when user submit a form , i need form data like in my case eventType and i want to attach all these selected rows to ONE event(bulk operation).Upto some extend i have worked on it, but the problem is how to submit $.fn.yiiGridView.getSelection data and form data to gather as i need both of them?

thanks

  1. Intercept click event using ajax : $("#buttonID").on("click", function(ev) { … } );

  2. In function(ev), get id from cgridview and eventually make an ajax request ( $.post, $.get );

  3. Then you can display results;

Thank you soo much it solved my problem :rolleyes: :rolleyes:

$(’.attach-form form’).submit(function(){

      jQuery.ajax({


        'success': function(data) {


             alert(data);


        },





        'type': 'POST',


        'data': [color="#4169E1"][b][i]$(this).serialize()+'&myData='+$.fn.yiiGridView.getSelection('violence-mentioned-grid'),[/i][/b][/color]


        'url': '" . $this->createUrl('/content/attach') . "',


          


    });

return false;

});

But this is not the final solution , Still there is problem when i am using $.fn.yiiGridView.getSelection, which is not working in pagination (if there are more row then limit: NOT posting during post).

again thank you soo much for help