Masteritec Posted November 3, 2020 Share Posted November 3, 2020 function beforeInit(sender, config) { config.loadingText='Loading...'; config.grouped=false; config.itemTpl= new Ext.XTemplate( '<tr><td><span style="font-size:18px;font-weight:bold;padding-top:4px;padding-left:5px;">{0}</span></td></tr>'+ '<table class="tblstock">'+ '<tr>' + '<td>'+ '<img src={5} width="120" height="120"/>' + '</td>'+ '<td>'+ '<table class="tblStockDescr">' + '<tr><td style="font-size:13px;padding-top:4px;padding-left:5px;line-height:1.2;">{1}{2}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:black;padding-top:4px;padding-left:5px;line-height:0.8;">Balance : {4}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:blue;padding-top:4px;padding-left:5px;line-height:0.8;">MYR 999,999.99</td></tr>'+ '<tr><td><input type="number" id="seqty" value="1" min="1" /></td></tr>' + '<tr><td><input type="button" class="addtocartbutton" value="Add to Cart" data-id="{0}"></td></tr>' + '</table>' + '</td>' + '</tr>' + '</table>' ); } function afterCreate(sender) { Ext.getCmp(sender.id).bodyElement.addListener('click', function(event, target) { if (target.getAttribute('class') === 'addtocartbutton') { var qty = 12; <== How to get back value from spin edit ID seqty? ajaxRequest(sender, "ADDTOCART", ['stockcode='+target.getAttribute('data-id'), 'qty='+qty]); } }, null, { delegate: 'table input' }); } Link to comment Share on other sites More sharing options...
Sherzod Posted November 3, 2020 Share Posted November 3, 2020 7 minutes ago, Masteritec said: How to get back value from spin edit ID seqty? Hello, Can you please explain in more details. Testcase? Link to comment Share on other sites More sharing options...
Masteritec Posted November 3, 2020 Author Share Posted November 3, 2020 24 minutes ago, Sherzod said: Hello, Can you please explain in more details. Testcase? Current i able to return {0} to AjaxRequest when click Add to Cart Button, Beside that , i also need usert to input quantity using Spin edit, then only click Add to Cart then return to AjaxRequest, I don't know to pass spin edit value to ajax request. Please help Link to comment Share on other sites More sharing options...
Sherzod Posted November 3, 2020 Share Posted November 3, 2020 Make a simple testcase if possible. Link to comment Share on other sites More sharing options...
Masteritec Posted November 3, 2020 Author Share Posted November 3, 2020 9 minutes ago, Sherzod said: Make a simple testcase if possible. Please refer my test case Unigui_Mobile_Listview.zip 1 Link to comment Share on other sites More sharing options...
Sherzod Posted November 3, 2020 Share Posted November 3, 2020 13 minutes ago, Masteritec said: Unigui_Mobile_Listview.zip 64.58 kB · 0 downloads Try these changes: function beforeInit(sender, config) { config.loadingText='Loading...'; config.grouped=false; config.itemTpl= new Ext.XTemplate( '<tr><td><span style="font-size:18px;font-weight:bold;padding-top:4px;padding-left:5px;">{0}</span></td></tr>'+ '<table class="tblstock">'+ '<tr>' + '<td>'+ '<img src={5} width="120" height="120"/>' + '</td>'+ '<td>'+ '<table class="tblStockDescr">' + '<tr><td style="font-size:13px;padding-top:4px;padding-left:5px;line-height:1.2;">{1}{2}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:black;padding-top:4px;padding-left:5px;line-height:0.8;">Balance : {4}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:blue;padding-top:4px;padding-left:5px;line-height:0.8;">MYR 999,999.99</td></tr>'+ '<tr><td><input type="number" id="seqty{0}" value="1" min="1" /></td></tr>' + '<tr><td><input type="button" class="addtocartbutton" value="Add to Cart" data-id="{0}"></td></tr>' + '</table>' + '</td>' + '</tr>' + '</table>' ); } function afterCreate(sender) { Ext.getCmp(sender.id).bodyElement.addListener('click', function(event, target) { if (target.getAttribute('class') === 'addtocartbutton') { var qty = 12; ajaxRequest(sender, "ADDTOCART", ['stockcode='+target.getAttribute('data-id'), 'qty='+Ext.get("seqty"+target.getAttribute('data-id')).getValue()]); } }, null, { delegate: 'table input' }); } Link to comment Share on other sites More sharing options...
Masteritec Posted November 4, 2020 Author Share Posted November 4, 2020 6 hours ago, Sherzod said: Try these changes: function beforeInit(sender, config) { config.loadingText='Loading...'; config.grouped=false; config.itemTpl= new Ext.XTemplate( '<tr><td><span style="font-size:18px;font-weight:bold;padding-top:4px;padding-left:5px;">{0}</span></td></tr>'+ '<table class="tblstock">'+ '<tr>' + '<td>'+ '<img src={5} width="120" height="120"/>' + '</td>'+ '<td>'+ '<table class="tblStockDescr">' + '<tr><td style="font-size:13px;padding-top:4px;padding-left:5px;line-height:1.2;">{1}{2}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:black;padding-top:4px;padding-left:5px;line-height:0.8;">Balance : {4}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:blue;padding-top:4px;padding-left:5px;line-height:0.8;">MYR 999,999.99</td></tr>'+ '<tr><td><input type="number" id="seqty{0}" value="1" min="1" /></td></tr>' + '<tr><td><input type="button" class="addtocartbutton" value="Add to Cart" data-id="{0}"></td></tr>' + '</table>' + '</td>' + '</tr>' + '</table>' ); } function afterCreate(sender) { Ext.getCmp(sender.id).bodyElement.addListener('click', function(event, target) { if (target.getAttribute('class') === 'addtocartbutton') { var qty = 12; ajaxRequest(sender, "ADDTOCART", ['stockcode='+target.getAttribute('data-id'), 'qty='+Ext.get("seqty"+target.getAttribute('data-id')).getValue()]); } }, null, { delegate: 'table input' }); } Thanks your help Link to comment Share on other sites More sharing options...
Masteritec Posted November 6, 2020 Author Share Posted November 6, 2020 On 11/4/2020 at 3:48 AM, Sherzod said: Try these changes: function beforeInit(sender, config) { config.loadingText='Loading...'; config.grouped=false; config.itemTpl= new Ext.XTemplate( '<tr><td><span style="font-size:18px;font-weight:bold;padding-top:4px;padding-left:5px;">{0}</span></td></tr>'+ '<table class="tblstock">'+ '<tr>' + '<td>'+ '<img src={5} width="120" height="120"/>' + '</td>'+ '<td>'+ '<table class="tblStockDescr">' + '<tr><td style="font-size:13px;padding-top:4px;padding-left:5px;line-height:1.2;">{1}{2}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:black;padding-top:4px;padding-left:5px;line-height:0.8;">Balance : {4}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:blue;padding-top:4px;padding-left:5px;line-height:0.8;">MYR 999,999.99</td></tr>'+ '<tr><td><input type="number" id="seqty{0}" value="1" min="1" /></td></tr>' + '<tr><td><input type="button" class="addtocartbutton" value="Add to Cart" data-id="{0}"></td></tr>' + '</table>' + '</td>' + '</tr>' + '</table>' ); } function afterCreate(sender) { Ext.getCmp(sender.id).bodyElement.addListener('click', function(event, target) { if (target.getAttribute('class') === 'addtocartbutton') { var qty = 12; ajaxRequest(sender, "ADDTOCART", ['stockcode='+target.getAttribute('data-id'), 'qty='+Ext.get("seqty"+target.getAttribute('data-id')).getValue()]); } }, null, { delegate: 'table input' }); } @Sherzod Attached is test case source code & Video for you to refer. Above code only ok for first time form show. Refer video First time click Show Cart -> Select 1221 -> Change Value to 5 -> Add to Cart -> ajaxRequest Show Message Correct. Close the Sreen Second time click Show Cart -> Select 1221 -> Screen value no change default to 1 -> Add to Cart -> ajaxRequest Show Message wrong it take back previos value and now whatever value you change it always show 5 only Please help WhatsApp Video 2020-11-06 at 11.43.20 AM.mp4 Unigui_Mobile_Listview2.7z Link to comment Share on other sites More sharing options...
Sherzod Posted November 6, 2020 Share Posted November 6, 2020 1 hour ago, Masteritec said: Attached is test case source code & Video for you to refer. I wil check... Link to comment Share on other sites More sharing options...
Sherzod Posted November 6, 2020 Share Posted November 6, 2020 3 hours ago, Masteritec said: it take back previos value and now whatever value you change it always show 5 only Try this approach: function beforeInit(sender, config) { config.loadingText='Loading...'; config.grouped=false; config.itemTpl= new Ext.XTemplate( '<tr><td><span style="font-size:18px;font-weight:bold;padding-top:4px;padding-left:5px;">{0}</span></td></tr>'+ '<table class="tblstock">'+ '<tr>' + '<td>'+ '<img src={5} width="120" height="120"/>' + '</td>'+ '<td>'+ '<table class="tblStockDescr">' + '<tr><td style="font-size:13px;padding-top:4px;padding-left:5px;line-height:1.2;">{1}{2}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:black;padding-top:4px;padding-left:5px;line-height:0.8;">Balance : {4}</td></tr>'+ '<tr><td style="font-size:13px;font-weight:bold;color:blue;padding-top:4px;padding-left:5px;line-height:0.8;">MYR 999,999.99</td></tr>'+ '<tr><td><input type="number" id="'+ config.id +'_seqty{0}" value="1" min="1" /></td></tr>' + '<tr><td><input type="button" class="addtocartbutton" value="Add to Cart" data-id="{0}"></td></tr>' + '</table>' + '</td>' + '</tr>' + '</table>' ); } function afterCreate(sender) { Ext.getCmp(sender.id).bodyElement.addListener('click', function(event, target) { if (target.getAttribute('class') === 'addtocartbutton') { ajaxRequest(sender, "ADDTOCART", ['stockcode='+target.getAttribute('data-id'), 'qty='+Ext.get(sender.id+"_seqty"+target.getAttribute('data-id')).getValue()]); } }, null, { delegate: 'table input' }); } Link to comment Share on other sites More sharing options...
warat mookdaanan Posted April 11, 2022 Share Posted April 11, 2022 i download but dbgrid not show same video do you have other file? Link to comment Share on other sites More sharing options...
Recommended Posts