JavaScript kendo ui resize column kendo resize columns,kendo column resize event,kendo autofit column,

I am using the following function(which i got from web) to resize the column in kendo ui. this is based on Index, i am looking out to see if there can be an option to select by column title or field/key.

when i reorder the grid column, this function fails.

 function resizeColumn(idx, width) {
            $("#grid .k-grid-header-wrap") //header
               .find("colgroup col")
               .eq(idx)
               .css({ width: width });

            $("#grid .k-grid-content") //content
               .find("colgroup col")
               .eq(idx)
               .css({ width: width });
        }
Answer:1

To resize by column title, you just need to figure out the correct index, e.g. like this:

function resizeColumn(title, width) {
    var index = $("#grid .k-grid-header-wrap").find("th:contains(" + title + ")").index();

    $("#grid .k-grid-header-wrap") //header
        .find("colgroup col")
        .eq(index)
        .css({ width: width });

    $("#grid .k-grid-content") //content
        .find("colgroup col")
        .eq(index)
        .css({ width: width });
}
Answer:2

Search column by field id to make sure that is the corrected field.

function resizeColumn(fieldId, width) {
    var index = $('#grid .k-grid-header-wrap').find('th[data-field="' + fieldId + '"]').index();

    $("#grid .k-grid-header-wrap") //header
        .find("colgroup col")
        .eq(index)
        .css({ width: width });

    $("#grid .k-grid-content") //content
        .find("colgroup col")
        .eq(index)
        .css({ width: width });
}
Answer:3

I need to convert session.lastAccessedTime object from jsp into Javascript Date object. Currently, it displays as long object. How can I convert to Javascript date object? console.log('...

I need to convert session.lastAccessedTime object from jsp into Javascript Date object. Currently, it displays as long object. How can I convert to Javascript date object? console.log('...

I'm trying to dubug next JavaScript code in on my HTML page: var langs = document.getElementsByClassName('ss-code-language'); for (var i in langs) { langs[i].classList.remove('ss-highlighted'); ...

I'm trying to dubug next JavaScript code in on my HTML page: var langs = document.getElementsByClassName('ss-code-language'); for (var i in langs) { langs[i].classList.remove('ss-highlighted'); ...

  1. canvas
  2. canada
  3. cancelled
  4. canceled vs cancelled
  5. canada vaccines
  6. canada goose
  7. cane corso
  8. canes
  9. canadian prime minister
  10. cancun flights
  11. canker sore
  12. candy
  13. cancer
  14. cancun
  15. canon
  16. canvas prints
  17. cancer sign
  18. candace owens
  19. canada news
  20. candytopia

I have 4 image tags with the id's of: picture_off picture_on go_forward go_backward picture_off and picture_on when clicked work. However, go_forward is supposed to, when clicked, to make a div ...

I have 4 image tags with the id's of: picture_off picture_on go_forward go_backward picture_off and picture_on when clicked work. However, go_forward is supposed to, when clicked, to make a div ...

  1. javascript buttons not working
  2. javascript buttons not working chrome
  3. javascript buttons not working in lightning
  4. javascript buttons don't work
  5. javascript buttons not working internet explorer
  6. javascript buttons stopped working
  7. firefox javascript buttons not working

Assuming you have the following: function doStuff() { //code } What is the the difference between the 2 statements ? window.onload = doStuff; window.onload = doStuff(); Both statements ...

Assuming you have the following: function doStuff() { //code } What is the the difference between the 2 statements ? window.onload = doStuff; window.onload = doStuff(); Both statements ...

  1. difference between assigning and delegating
  2. difference between assigning work and delegating work
  3. difference between assigning and delegating in nursing
  4. difference between assigning and subletting
  5. difference between assigning and licensing copyright
  6. difference between assigning and publishing an application
  7. difference between assignment and novation
  8. difference between assigning a lease and subletting
  9. difference between assigning and transferring
  10. difference between assignment and subcontracting
  11. difference between assigning a mortgage and assuming a mortgage
  12. difference between assigning and licensing
  13. difference between assignment and subrogation
  14. difference between assignment problem and transportation problem
  15. difference between assignment and nomination
  16. difference between assignment and project
  17. difference between assignment and homework
  18. difference between assignment and license
  19. difference between assignment and assessment
  20. difference between assignment and sublease