how to set a column with to 0

how to set a column with to 0

prabu1981prabu1981 Posts: 3Questions: 1Answers: 0

i have 10 column in my data table. the user will input values in last 5 columns and based on that ( last 5 columns) first 5 columns will be populated (calculated values will be stored in first 5 columns)

I dont want to show the first 5 columns to be visible to the user.. any ideas ?

i dont want to use bVisible just want to make the column width to zero !!!

Please help. Thanks

Prabu

Answers

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin

    I'm confused, why can't you use bVisible ? It sounds like exactly what you want - if you don't want the column to be visible.

    Allan

  • prabu1981prabu1981 Posts: 3Questions: 1Answers: 0

    Thanks Allan. I am very new to HTML, jquery and data table.
    i have a table with 10 columns. i have designed the last 5 columns as text box using <input> tag. first 5 columns just as normal <td>. when the user enter values in the text box i want to copy the same in to the respective first five columns (ex i need to copy the 5 column value to 0 column and 6 column value to 1 column etc.. ).

    When i use the bVisible, i dont see the first 5 columns but the jquery i have is replacing the actual column itself (the column were i have the text box)

    $('.copydata').live('focusout', function (e) {
    var table = document.getElementById('MenuItemtbl'),
    rows = table.getElementsByTagName('tr'),
    cells = rows[1].getElementsByTagName('td');
    cells[1].innerHTML = $(this).val();
    });

    In the above code (when using bVisible = false), the code is updating the cell 1 which is the text box column (but it is suppose to update the hidden column)

    Hope i am able to explain the issue here, if not my apologizes.

    Thanks.

  • prabu1981prabu1981 Posts: 3Questions: 1Answers: 0
    edited January 2015

    Thats why want to use have the first 5 columns width as zero so that the jquery will update the correct 5 columns instead of the actual text box columns.

    in the other hand, if show all the columns (visible true for all 10 columns) the above code updates the correct respective columns.

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin

    When i use the bVisible, i dont see the first 5 columns but the jquery i have is replacing the actual column itself (the column were i have the text box)

    You need to use the API to access the nodes - row().nodes() for example. They are removed from the DOM when they are hidden.

    Allan

This discussion has been closed.