Jsf h:commandlink not working in pagination

Jsf h:commandlink not working in pagination

antoniodlmataantoniodlmata Posts: 3Questions: 0Answers: 0
edited November 2013 in General
Hello,

I have been working with this plugin for a couple of months and i have found a problem that seems i am not able to solve alone.
So thaks in advance to anybody that can help me with my doubt.

I am updating from my table in order to make an ajax call to the server to get the entries of my table with some parameters i fullfill in a form. As you see:

[code]



[/code]

I have managed to get the pagination and the plugin to work perfectly in this sense. But my problem comes here.

One of the columns conains a with the following structure:

[code]



[/code]

This link works perfectly for the entries in the table in the first page of the table, but it does nothing in the ones that go in the rest of the pages of the table.

Every time i re-render the tables with ajax i call this function to apply the plugin:

[code]

//<![CDATA[
// Datatables
function up(){
$("input[type=checkbox], input:radio, input:file").uniform();
var dontSort = [];
$('#datatable_assets thead th').each( function () {
if ( $(this).hasClass( 'no_sort' )) {
dontSort.push( { "bSortable": false } );
} else {
dontSort.push( null );
}
} );
$('#datatable_assets').dataTable( {
// "sDom": "<'row-fluid table_top_bar'<'span12'>'<'to_hide_phone'>'f'<'>r>t<'row-fluid'>",
"sDom": "<'row-fluid table_top_bar'<'span12'<'to_hide_phone' f>>>t<'row-fluid control-group full top' <'span4 to_hide_tablet'l><'span8 pagination'p>>",
"aaSorting": [[ 0, "desc" ]],
"bPaginate": true,

"sPaginationType": "full_numbers",
"bJQueryUI": false,
"aoColumns": dontSort,
} );
$.extend( $.fn.dataTableExt.oStdClasses, {
"s`": "dataTables_wrapper form-inline"
} );
// Chosen select plugin
$(".chzn-select, .dataTables_length select").chosen({
disable_search_threshold: 10

});
$("#tableUpdate").show();
}
//]]>

[/code]

I am quite lost the past days looking for a solution.

Thanks a lot.

Replies

  • antoniodlmataantoniodlmata Posts: 3Questions: 0Answers: 0
    As a curiositiy i will also comment that h:commandlink action does not work in pagintation, but event onclick with calls to my backing bean does.

    [code]





    [/code]

    Any clues??
  • antoniodlmataantoniodlmata Posts: 3Questions: 0Answers: 0
    Hello again,

    I have develop a possible temporal solution to this problem using my last post discovery, calls to the backing bean with the javascript in the commandlink "onclick".

    I have added a from with the style "display: none" inside the box that contains my datatable.
    This form has as many input fields as variables you need to pass to your backing bean, and a commandButton with the action you want to call.

    After this, i add in the comandlink onclick callls to my backing bean to fullfill the form and an to process the id of the other form.

    More or less as follow:

    [code]






    [/code]

    And the form:

    [code]







    [/code]

    By doing this i managed to avoid the problem of executing the backing action without using the commandlink wich does not work in pagination.

    Note that it is important to add both:

    [code]
    document.getElementById('but').click();


    [/code]

    The reason is that the call does nothing, but adding it avoids commandLink action to be executed and redirect to without executing the form.

    And the (but).click() executes de form, it is also possible to add another call in the second form if you want to perform the action with ajax.
This discussion has been closed.