c# - Obtain data from checked rows in iggrid with checkboxes -
i have grid stores info of selected row in array when clicked. method works fine, i'm trying alter can select multiple rows checkbox , able store date in array. basically, instead of adding 1 row @ time in array, want able add together multiple rows checked in it. don't know if guys follow me please code can find way that.
here is,
javascript :
class="lang-js prettyprint-override">$('#gridbindcontact').on('iggridselectionactiverowchanged', function (event, args) { $("#primarykey").val(args.row.element[0].cells[1].textcontent); $("#contacttobind_numcon").val(args.row.element[0].cells[1].textcontent); $("#contacttobind_fullname").val(args.row.element[0].cells[2].textcontent + ' ' + args.row.element[0].cells[3].textcontent); $("#contacttobind_titcon").val(args.row.element[0].cells[4].textcontent); $("#contacttobind_tel1con").val(args.row.element[0].cells[5].textcontent); $("#contacttobind_tel2con").val(args.row.element[0].cells[6].textcontent); $("#contacttobind_emailcon").val(args.row.element[0].cells[7].textcontent); $("#contacttobind_numemployees").val(args.row.element[0].cells[8].textcontent); $("#contacttobind_nameemployees").val(args.row.element[0].cells[9].textcontent); $("#contacttobind_added").val(true); $(".ui-button-text").trigger("click"); });
in view :
class="lang-cs prettyprint-override">@(html.infragistics.grid(of contact)(model.results).id("gridbindcontact"). autogeneratecolumns(false). width("100%"). height("400px"). responsedatakey("results"). columns(sub(column) column.for(function(e) e.numcon).template("${numcon}").headertext("num") column.for(function(e) e.pnmcon).template("${pnmcon}").headertext("pnm").width("10%") column.for(function(e) e.namemcon).template("${namecon}").headertext("name").width("15%") column.for(function(e) e.titcon).template("${titcon}").headertext("title").width("20%") column.for(function(e) e.tel1con).template("${tel1con}").headertext("tel1") column.for(function(e) e.tel2con).template("${tel2con}").headertext("tel2") column.for(function(e) e.emailcon).template("${emailcon}").headertext("email") column.for(function(e) e.numemployees).headertext("num emp") column.for(function(e) e.nameemployees).headertext("name emp") end sub). features(sub(features) features.sorting().type(optype.local) features.rowselectors.enablecheckboxes(true).rowselectorscolumnwidth("50px").enablerownumbering(false) features.selection().mode(selectionmode.row).multipleselection(true).addclientevent("activerowchanging", "activerowchanging") features.updating().editmode(grideditmode.none).enableaddrow(false).enabledeleterow(false) end sub).render()) <form action="#" id="ajaxform" method="post"> @html.hiddenfor(function(x) x.primarykey) @html.hiddenfor(function(x) x.contacttobind.numcon) @html.hiddenfor(function(x) x.contacttobind.fullname) @html.hiddenfor(function(x) x.contacttobind.titcon) @html.hiddenfor(function(x) x.contacttobind.tel1con) @html.hiddenfor(function(x) x.contacttobind.tel2con) @html.hiddenfor(function(x) x.contacttobind.emailcon) @html.hiddenfor(function(x) x.contacttobind.numemployees) @html.hiddenfor(function(x) x.contacttobind.nameemployees) </form>
i added feature have checkboxes in grid, got nil handle them yet !
///////////////////////////////////////////////////////////////////////////////////////////
little edit can clear things
let me seek elaborate little more want able exactly. want able add together info rows checked in row array batch. said, let's checked 3 rows. when press 'ok' button, should store info 3 rows in array.
if succeed, array should have 3 'elements'. example, array[0] contain info first row checked. allow me access each cells , store 'textcontent' them in 'contacttobind' i'm using store each cell info @ moment.
i hope clears little bit !
thanks alot help.
guillaume
you can utilize .iggrid( "allrows" );
rows in grid, save in variable named "myrows"
. write javascript code traverse through "myrows"
got .iggrid( "allrows" )
, check value of each row's combo box. if current row has combo box "checked", set current row in array. @ end of loop have rows in array checked.
if dont know how traverse through "allrows"
stored in "myrows"
variable, utilize console.log(myrows)
, check object construction in browser's console window. able see how checkbox columns, not sure please check using console.log:
for(var = 0 ; < myrows.length ; ++ ) { myrows[i].cells....(select checked combobox) if yes store myrows[i] in array; }
c# javascript visual-studio-2012 infragistics iggrid
No comments:
Post a Comment