{"action":"created","issue":{"url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/725","labels_url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/725/labels{/name}","comments_url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/725/comments","events_url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/725/events","html_url":"https://github.com/wenzhixin/bootstrap-table/issues/725","id":67506209,"number":725,"title":"Find $row using itemId - or at least page number","user":{"login":"dabros","id":780783,"avatar_url":"https://avatars.githubusercontent.com/u/780783?v=3","gravatar_id":"","url":"https://api.github.com/users/dabros","html_url":"https://github.com/dabros","followers_url":"https://api.github.com/users/dabros/followers","following_url":"https://api.github.com/users/dabros/following{/other_user}","gists_url":"https://api.github.com/users/dabros/gists{/gist_id}","starred_url":"https://api.github.com/users/dabros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabros/subscriptions","organizations_url":"https://api.github.com/users/dabros/orgs","repos_url":"https://api.github.com/users/dabros/repos","events_url":"https://api.github.com/users/dabros/events{/privacy}","received_events_url":"https://api.github.com/users/dabros/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-10T04:25:50Z","updated_at":"2015-06-25T14:39:00Z","closed_at":null,"body":"To find the matching $element row (or at least its page number) by passing in the value of that row's options.itemId.\r\n\r\nIm trying to make up a public function in bootstrap-table.js or even just callback code to do this.\r\n\r\nAt the very least i want to be able to find the page number to go to. I have a function to find matching data row, but only have an idea on how to get pageNumber from that.\r\n\r\nMy current idea is use my onPostPagination() function, called anytime pagination is updated, and check there by calling to a function like:\r\n\r\n``` javascript\r\n  BootstrapTable.prototype.getRowByItemId = function (row_itemid, justIndex) {\r\n        /// console.info('BootstrapTable.selectRowByItemId started', { row_itemid: row_itemid, data: this.options.data });\r\n        var that = this;\r\n        justIndex = (typeof justIndex !== 'undefined' && !!justIndex);\r\n        var matching_row = null;\r\n        if (that.options.itemId !== undefined ) {\r\n            $.each(that.options.data, function(d_i, d_val){\r\n                /// console.log('BootstrapTable.selectRowByItemId checking row', [d_i, d_val, row_itemid]);\r\n                if (d_val != null && d_val.hasOwnProperty(that.options.itemId) && d_val[that.options.itemId] == row_itemid) {\r\n                    /// console.log('BootstrapTable.selectRowByItemId match found!!', d_val);\r\n                    matching_row = ( (justIndex) ? d_i : d_val);\r\n                    // Return false to exit loop\r\n                    return false;\r\n                }\r\n            });\r\n        }\r\n        else\r\n            console.error('BootstrapTable.selectRowByItemId error: itemId must be defined', { 'row_itemid': row_itemid, 'that.options.itemId': that.options.itemId });\r\n\r\n        return matching_row;\r\n    };\r\n```\r\n\r\nBut obviously this doesnt do anything for pagination index. \r\n\r\nNow, i could assume that d_i (the index in this.options.data) is the row number (assuming also this accounts for sorting) then try to find pagination number_per_page and assume page number from that.\r\n\r\nDoes this sound like best idea, or is there a better idea out there?\r\n\r\n\r\nEDIT (10/4): added 'justIndex' argument to example code"},"comment":{"url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/comments/115278743","html_url":"https://github.com/wenzhixin/bootstrap-table/issues/725#issuecomment-115278743","issue_url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/725","id":115278743,"user":{"login":"djhvscf","id":4496763,"avatar_url":"https://avatars.githubusercontent.com/u/4496763?v=3","gravatar_id":"","url":"https://api.github.com/users/djhvscf","html_url":"https://github.com/djhvscf","followers_url":"https://api.github.com/users/djhvscf/followers","following_url":"https://api.github.com/users/djhvscf/following{/other_user}","gists_url":"https://api.github.com/users/djhvscf/gists{/gist_id}","starred_url":"https://api.github.com/users/djhvscf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djhvscf/subscriptions","organizations_url":"https://api.github.com/users/djhvscf/orgs","repos_url":"https://api.github.com/users/djhvscf/repos","events_url":"https://api.github.com/users/djhvscf/events{/privacy}","received_events_url":"https://api.github.com/users/djhvscf/received_events","type":"User","site_admin":false},"created_at":"2015-06-25T14:39:00Z","updated_at":"2015-06-25T14:39:00Z","body":"Can you open a PR with this changes @dabros ??"}}