Column values appear hidden

Column values appear hidden

cousinitcousinit Posts: 9Questions: 3Answers: 0

Link to test case:
https://dttemp.azurewebsites.net/vMatch.html
Debugger code (debug.datatables.net):
erejuh
Error messages shown:

Description of problem:
Desired result is to have the both Vendor and Common Text Columns display the same value for their particular row. I have it rendering to the point where I can edit either column and the other column will update accordingly which is exactly what I want, however, the only problem is the values for both columns display as hidden. Any help or guidance to have them not be hidden would be greatly appreciated.

Thank you!

Regards,

John

Answers

  • cousinitcousinit Posts: 9Questions: 3Answers: 0

    Here is the JS code I am using for the rendering...

    `{ data: "Vendor", render: function(data,type,row,val){ editor.field('String').input().on( 'keyup',function(){ editor.field('Vendor').val( this.value);})}},
    
    { data: "String", render: function(data,type,row,val){ editor.field('Vendor').input().on( 'keyup',function(){ editor.field('String').val( this.value);})}},
    

    `

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin

    Your render function isn't returning anything, which is why DataTables is giving an error. If there is no return value, it is the same as return undefined; - thus there is nothing to show. render must return the value to show

    Also, you really don't want to add an event listener in the render function. It will be called multiple times for each row, and for every row of data. That would result in a lot of event handlers being added to the input events.

    I don't quite get what there are both Vendor and String properties in the data being loaded if they are identical?

    Allan

  • cousinitcousinit Posts: 9Questions: 3Answers: 0

    Thank you Allan!

    Sorry my example was not too clear. The String column is passed the longest common string from the Description Column. If the Vendor column is Blank then it should be populated with the "LCS" String column value. I also would like to be able make a manual update on the Vendor column row value and have that update the string column value.

    Hope that makes it a little more clear. I updated my example.

    Thank you Allan!

    John

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin

    Hi,

    Thanks for the additional information. Your page has:

    { data: "Vendor", render: function(data,type,row,val){ editor.field('Vendor').input().on( 'keyup',function(){ editor.field('String').val( this.value);})}},
    

    so it still isn't returning a value for that column, which is why it is still giving an error when loading the table.

    I doubt you want a rendering function there. Instead, add your keyup listener outside of the table initialisation.

    Allan

  • cousinitcousinit Posts: 9Questions: 3Answers: 0

    Thank you Allan!! I'll give that a shot.

    John

This discussion has been closed.