FlexiGrid supports shift multi-Choice

Source: Internet
Author: User
Based on the Flexigrid processing in the previous chapters, the shift multi-choice function is supported, the added code marks the multiple-choice addbydanielinbiti for processing shfit. It mainly adds three parts. The first part of the code is [javascript] (function ($) {$ addFlexfun. Based on the previous sections of Flexigrid, the shift multi-choice function is supported, and the added code indicates "// processing shfit multi-choice add by danielinbiti". The first part of the code is mainly added to [javascript] (function ($) {$. addFlex = function (t, p) {if (t. grid) return false; // return if already exist p = $. extend ({// apply default properties height: 200, // default height w Idth: 'auto', // auto width striped: true, // apply odd even stripes novstripe: false, minwidth: 30, // min width of columns minheight: 80, // min height of columns resizable: true, // allow table resizing url: false, // URL if using data from AJAX dwrAction: function () {}, method: 'post', // data sending method dataType: 'xml', // type of data for AJAX, either xml or json errormsg: 'Connection error', usep Ager: false, nowrap: true, page: 1, // current page total: 1, // total pages useRp: true, // use the results per page select box rp: 15, // results per page rpOptions: [10, 15, 20, 30, 50], // allowed per-page values title: false, pagestat: 'displaying {from} to {to} of {total} items ', pagetext: 'page', outof: 'of', findtext: 'Find', procmsg: 'processing, please wait... ', query: '', qtype:'', isColSe L: true, nomsg: 'No items ', minColToggle: 1, // minimum allowed column to be hidden showToggleBtn: true, // show or hide column toggle popup hideOnSubmit: true, autoload: true, blockOpacity: 0.5, preProcess: false, onDragCol: false, onToggleCol: false, onChangeSort: false, onSuccess: false, onError: false, onRowClick: function () {return true}, // add by jej onSubmit: false // using a custom populate funct Ion}, p); $ (t ). show () // show if hidden. attr ({cellPadding: 0, cellSpacing: 0, border: 0}) // remove padding and spacing. removeAttr ('width'); // remove width properties // create grid class isEditing = false; isShiftMulti = false; // process shfit multiple options add by danielinbiti shiftSelRowIndex =-1; // process shfit multiple options add by danielinbiti $ ('body '). keydown (function (e) {// process shfit multiple options add by danielinbiti if (e. keyCode = 16) {isShiftMulti = true ;}}); $ ('body '). keyup (function (e) {// process shfit multiple options add by danielinbiti if (e. keyCode = 16) {isShiftMulti = false; shiftSelRowIndex =-1 ;}}) Part 2 [javascript] getSelectRowsToGrid: function () {// process shfit multiple options add by danielinbiti // add by jej var rtnList = new Array (); var objRows = $ ('. trSelected ', $ (t); if (objRows! = Null) {for (var I = 0; I 0) {arr [j] = inputbox [0]. value ;}} else {var value = row. cells [j]. innerText; value = value. replace (/^ \ n + | \ n + $/g, ""); arr [j] = value ;}} rtnList [rtnList. length] = arr ;}} return rtnList;} Part 3 [javascript] addRowProp: function () {var _ self = this; $ ('tbody tr', g. bDiv ). each (function () {$ (this ). click (function (e) {var obj = (e.tar get | e. srcElement); if (obj. href | obj. type) return true; $ (thi S ). toggleClass ('trselected'); if (p. singleSelect) $ (this ). siblings (). removeClass ('trselected'); if (p. onRowClick & typeof (p. onRowClick) = 'function') {var rowObj = _ self. getRows (); p. onRowClick (rowObj, e );}}). mousedown (function (e) {if (e. shiftKey) {$ (this ). toggleClass ('trselected'); g. multisel = true; this. focus (); $ (g. gDiv ). noSelect (); if (isShiftMulti &&! P. singleSelect) {// process shfit multiple options add by danielinbiti _ self. selectRowByIndexArea ($ (this) [0]. rowIndex, shiftSelRowIndex); // process shfit multiple options add by danielinbiti shiftSelRowIndex = $ (this) [0]. rowIndex; // process the shfit multiple options add by danielinbiti} code with more context to facilitate adding to the file.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.