batchedit.ui.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. window.renderRowData = function($row, index, row)
  2. {
  3. const product = row;
  4. $row.find('[data-name="line"]').find('.picker-box').on('inited', function(e, info)
  5. {
  6. let $line = info[0];
  7. let lineItems = [];
  8. if(lines[product.program] != undefined)
  9. {
  10. linePairs = lines[product.program];
  11. $.each(linePairs, function(lineID, lineName)
  12. {
  13. lineItems.push({value: lineID, text: lineName});
  14. });
  15. }
  16. $line.render({items: lineItems});
  17. });
  18. }
  19. /**
  20. * Load product lines by program.
  21. *
  22. * @param event e
  23. * @access public
  24. * @return void
  25. */
  26. function loadProductLines(e)
  27. {
  28. const $target = $(event.target);
  29. const $currentRow = $target.closest('tr');
  30. const programID = $currentRow.find('input[name^=program]').val();
  31. const productID = $currentRow.find('input[name^=productIdList]').val();
  32. const lineID = $currentRow.find('input[name^=line]').val();
  33. const link = $.createLink('product', 'ajaxGetLine', 'programID=' + programID + '&productID=' + productID);
  34. $.getJSON(link, function(lines)
  35. {
  36. $currentRow.find('input[name^="line"]').zui('picker').render({items: lines.items});
  37. $currentRow.find('input[name^="line"]').zui('picker').$.setValue(lineID);
  38. });
  39. }